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:
Nigel Tao committed 2018-02-21 16:14:19 +11:00
1 parent 11ad47af86
commit 0ad23714c6
2 files changed
+4 -3

No files matched your search

+2 -1
View File
@@ -752,7 +752,8 @@ func (g *gen) writeReadUXX(b *buffer, n *a.Expr, name string, size uint32, endia
b.printf("& 0xFF;") b.printf("& 0xFF;")
b.printf("%s >>= 8;", scratchName) b.printf("%s >>= 8;", scratchName)
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) scratchName, bPrefix, name, tPrefix, temp0)
case "le": case "le":
b.printf(">> 56;") b.printf(">> 56;")
+2 -2
View File
@@ -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 <<= 8; self->private_impl.c_decode[0].scratch <<= 8;
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*b_rptr_src++)) self->private_impl.c_decode[0].scratch |= ((uint64_t)(*b_rptr_src++))
<< (64 - t_0); << (56 - t_0);
if (t_0 == 8) { if (t_0 == 8) {
t_1 = self->private_impl.c_decode[0].scratch >> (64 - 16); t_1 = self->private_impl.c_decode[0].scratch >> (64 - 16);
break; 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 <<= 8; self->private_impl.c_decode[0].scratch <<= 8;
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*b_rptr_src++)) self->private_impl.c_decode[0].scratch |= ((uint64_t)(*b_rptr_src++))
<< (64 - t_3); << (56 - t_3);
if (t_3 == 24) { if (t_3 == 24) {
t_4 = self->private_impl.c_decode[0].scratch >> (64 - 32); t_4 = self->private_impl.c_decode[0].scratch >> (64 - 32);
break; break;