mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Fix read_uxxbe across an I/O short read
Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6473
This commit is contained in:
1 parent
11ad47af86
commit
0ad23714c6
2 files changed
+4
-3
No files matched your search
@@ -752,7 +752,8 @@ func (g *gen) writeReadUXX(b *buffer, n *a.Expr, name string, size uint32, endia
|
||||
b.printf("& 0xFF;")
|
||||
b.printf("%s >>= 8;", scratchName)
|
||||
b.printf("%s <<= 8;", scratchName)
|
||||
b.printf("%s |= ((uint64_t)(*%srptr_%s++)) << (64 - %s%d);",
|
||||
// TODO: make a test case for 56 (correct) vs 64 (incorrect).
|
||||
b.printf("%s |= ((uint64_t)(*%srptr_%s++)) << (56 - %s%d);",
|
||||
scratchName, bPrefix, name, tPrefix, temp0)
|
||||
case "le":
|
||||
b.printf(">> 56;")
|
||||
|
||||
+2
-2
@@ -1035,7 +1035,7 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
self->private_impl.c_decode[0].scratch >>= 8;
|
||||
self->private_impl.c_decode[0].scratch <<= 8;
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*b_rptr_src++))
|
||||
<< (64 - t_0);
|
||||
<< (56 - t_0);
|
||||
if (t_0 == 8) {
|
||||
t_1 = self->private_impl.c_decode[0].scratch >> (64 - 16);
|
||||
break;
|
||||
@@ -1130,7 +1130,7 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
self->private_impl.c_decode[0].scratch >>= 8;
|
||||
self->private_impl.c_decode[0].scratch <<= 8;
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*b_rptr_src++))
|
||||
<< (64 - t_3);
|
||||
<< (56 - t_3);
|
||||
if (t_3 == 24) {
|
||||
t_4 = self->private_impl.c_decode[0].scratch >> (64 - 32);
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user