Skip to content

Commit 40c1ec5

Browse files
committed
Resync
1 parent e3d473d commit 40c1ec5

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

formats/png/rpng.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -955,19 +955,8 @@ static bool read_chunk_header(uint8_t *buf, uint8_t *buf_end,
955955
struct png_chunk *chunk)
956956
{
957957
unsigned i;
958-
uint8_t dword[4];
959958

960-
dword[0] = '\0';
961-
962-
/* Check whether reading the header will overflow
963-
* the data buffer */
964-
if (buf_end - buf < 8)
965-
return false;
966-
967-
for (i = 0; i < 4; i++)
968-
dword[i] = buf[i];
969-
970-
chunk->size = dword_be(dword);
959+
chunk->size = dword_be(buf);
971960

972961
/* Check whether chunk will overflow the data buffer */
973962
if (buf + 8 + chunk->size > buf_end)
@@ -1019,6 +1008,10 @@ bool rpng_iterate_image(rpng_t *rpng)
10191008
if (buf > rpng->buff_end)
10201009
return false;
10211010

1011+
/* Check whether reading the header will overflow
1012+
* the data buffer */
1013+
if (rpng->buff_end - buf < 8)
1014+
return false;
10221015
if (!read_chunk_header(buf, rpng->buff_end, &chunk))
10231016
return false;
10241017

0 commit comments

Comments
 (0)