mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 16:47:28 +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
@@ -209,10 +209,12 @@ puffs_gif_status puffs_gif_lzw_decoder_decode(puffs_gif_lzw_decoder* self,
|
||||
|
||||
uint32_t v_bits;
|
||||
uint32_t v_n_bits;
|
||||
uint32_t v_clear_code;
|
||||
uint32_t v_width;
|
||||
|
||||
v_bits = 0;
|
||||
v_n_bits = 0;
|
||||
v_clear_code = (((uint32_t)(1)) << self->f_literal_width);
|
||||
v_width = (self->f_literal_width + 1);
|
||||
while (1) {
|
||||
while ((v_n_bits < v_width)) {
|
||||
@@ -226,6 +228,9 @@ puffs_gif_status puffs_gif_lzw_decoder_decode(puffs_gif_lzw_decoder* self,
|
||||
}
|
||||
v_bits >>= v_width;
|
||||
v_n_bits -= v_width;
|
||||
if ((v_bits < v_clear_code)) {
|
||||
goto label_0_break;
|
||||
}
|
||||
goto label_0_break;
|
||||
}
|
||||
label_0_break:;
|
||||
|
||||
Reference in new issue
Block a user