mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 00:47:28 +01:00
Tweak the flate end_of_block check.
This commit is contained in:
1 parent
aa1f0078db
commit
8fafcbcb31
2 files changed
+15
-8
No files matched your search
+8
-4
@@ -1135,6 +1135,9 @@ static puffs_flate__status puffs_flate__flate_decoder__decode_blocks(
|
||||
if (status) {
|
||||
goto suspend;
|
||||
}
|
||||
if (self->private_impl.f_end_of_block) {
|
||||
goto label_0_continue;
|
||||
}
|
||||
PUFFS_BASE__COROUTINE_SUSPENSION_POINT(6);
|
||||
if (a_src.buf) {
|
||||
size_t n = b_rptr_src - (a_src.buf->ptr + a_src.buf->ri);
|
||||
@@ -1154,11 +1157,12 @@ static puffs_flate__status puffs_flate__flate_decoder__decode_blocks(
|
||||
if (status) {
|
||||
goto suspend;
|
||||
}
|
||||
if (!self->private_impl.f_end_of_block) {
|
||||
status =
|
||||
PUFFS_FLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK;
|
||||
goto exit;
|
||||
if (self->private_impl.f_end_of_block) {
|
||||
goto label_0_continue;
|
||||
}
|
||||
status =
|
||||
PUFFS_FLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
goto ok;
|
||||
|
||||
@@ -201,11 +201,14 @@ pri func flate_decoder.decode_blocks?(dst writer1, src reader1)() {
|
||||
|
||||
this.end_of_block = false
|
||||
this.decode_huffman_fast?(dst:in.dst, src:in.src)
|
||||
// TODO: check this.end_of_block.
|
||||
this.decode_huffman_slow?(dst:in.dst, src:in.src)
|
||||
if not this.end_of_block {
|
||||
return error "internal error: inconsistent Huffman end_of_block"
|
||||
if this.end_of_block {
|
||||
continue
|
||||
}
|
||||
this.decode_huffman_slow?(dst:in.dst, src:in.src)
|
||||
if this.end_of_block {
|
||||
continue
|
||||
}
|
||||
return error "internal error: inconsistent Huffman end_of_block"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user