mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 16:32:11 +01:00
Guard against the LZW literal_width changing
This commit is contained in:
1 parent
f10ff8c896
commit
e0478b1d91
3 files changed
+11
-4
No files matched your search
@@ -40,7 +40,8 @@ pri func lzw_decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
// `max`. 4096 means do not save.
|
||||
var save_code base.u32[..4096] = end_code
|
||||
var prev_code base.u32[..4095]
|
||||
var width base.u32[..12] = this.literal_width + 1
|
||||
var initial_width base.u32[..12] = this.literal_width + 1
|
||||
var width base.u32[..12] = initial_width
|
||||
|
||||
// These variables yield src's bits in Least Significant Bits order.
|
||||
var bits base.u32
|
||||
@@ -73,7 +74,7 @@ pri func lzw_decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
} else if code == clear_code {
|
||||
save_code = end_code
|
||||
prev_code = 0
|
||||
width = this.literal_width + 1
|
||||
width = initial_width
|
||||
continue
|
||||
|
||||
} else if code == end_code {
|
||||
|
||||
Reference in new issue
Block a user