Simplify rpng.c - read_chunk

This commit is contained in:
twinaphex 2020-08-22 14:20:50 +02:00
parent fa68500475
commit 2e6b87d156
1 changed files with 4 additions and 5 deletions

View File

@ -959,11 +959,6 @@ static bool read_chunk_header(uint8_t *buf, uint8_t *buf_end,
dword[0] = '\0';
/* Check whether reading the header will overflow
* the data buffer */
if (buf_end - buf < 8)
return false;
for (i = 0; i < 4; i++)
dword[i] = buf[i];
@ -1019,6 +1014,10 @@ bool rpng_iterate_image(rpng_t *rpng)
if (buf > rpng->buff_end)
return false;
/* Check whether reading the header will overflow
* the data buffer */
if (rpng->buff_end - buf < 8)
return false;
if (!read_chunk_header(buf, rpng->buff_end, &chunk))
return false;