mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 00:38:14 +01:00
Bounds check "if" statements.
This commit is contained in:
1 parent
f686adc3c0
commit
84bf437013
4 files changed
+149
-5
No files matched your search
@@ -8,9 +8,8 @@ pub struct lzw_decoder?(
|
||||
pub func lzw_decoder.decode?(dst ptr buf1, src ptr buf1, src_final bool)() {
|
||||
var bits u32
|
||||
var n_bits u32
|
||||
|
||||
// TODO: set clear_code, end_code, etc.
|
||||
|
||||
var clear_code u32 = (1 as u32) << this.literal_width
|
||||
// TODO: set end_code.
|
||||
var width u32[..12] = this.literal_width + 1
|
||||
|
||||
// TODO: implement.
|
||||
@@ -31,6 +30,11 @@ pub func lzw_decoder.decode?(dst ptr buf1, src ptr buf1, src_final bool)() {
|
||||
bits >>= width
|
||||
n_bits -= width
|
||||
|
||||
// TODO: s/bits/code/
|
||||
if bits < clear_code {
|
||||
break
|
||||
}
|
||||
|
||||
// TODO: implement.
|
||||
break
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user