Allow an LZW literal width of 0

This commit is contained in:
Nigel Tao committed 2019-05-26 15:52:07 +10:00
1 parent af4e327a8f
commit d41430c4f5
3 files changed
+16 -16

No files matched your search

+5 -5
View File
@@ -8140,12 +8140,12 @@ wuffs_lzw__decoder__set_literal_width(wuffs_lzw__decoder* self, uint32_t a_lw) {
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
return wuffs_base__make_empty_struct();
}
if (a_lw < 1 || a_lw > 8) {
if (a_lw > 8) {
self->private_impl.magic = WUFFS_BASE__DISABLED;
return wuffs_base__make_empty_struct();
}
self->private_impl.f_set_literal_width_arg = a_lw;
self->private_impl.f_set_literal_width_arg = (a_lw + 1);
return wuffs_base__make_empty_struct();
}
@@ -8198,7 +8198,7 @@ wuffs_lzw__decoder__decode_io_writer(wuffs_lzw__decoder* self,
self->private_impl.f_literal_width = 8;
if (self->private_impl.f_set_literal_width_arg > 0) {
self->private_impl.f_literal_width =
self->private_impl.f_set_literal_width_arg;
(self->private_impl.f_set_literal_width_arg - 1);
}
self->private_impl.f_clear_code =
(((uint32_t)(1)) << self->private_impl.f_literal_width);
@@ -9307,7 +9307,7 @@ wuffs_gif__decoder__skip_frame(wuffs_gif__decoder* self,
uint8_t t_1 = *iop_a_src++;
v_lw = t_1;
}
if ((v_lw < 1) || (8 < v_lw)) {
if (v_lw > 8) {
status = wuffs_gif__error__bad_literal_width;
goto exit;
}
@@ -10800,7 +10800,7 @@ wuffs_gif__decoder__decode_id_part1(wuffs_gif__decoder* self,
uint8_t t_2 = *iop_a_src++;
v_lw = t_2;
}
if ((v_lw < 1) || (8 < v_lw)) {
if (v_lw > 8) {
status = wuffs_gif__error__bad_literal_width;
goto exit;
}