1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-30 00:00:16 +01:00

upng: fuzz: handle 0 width

This commit is contained in:
Andy Green 2024-05-16 08:41:43 +01:00
parent 1e0953ffb8
commit d1d622d3b9

View file

@ -405,6 +405,8 @@ lws_upng_decode(lws_upng_t* u, const uint8_t **_pos, size_t *_size)
u->acc = (u->acc << 8) | *pos++;
if (++u->sctr == 4) {
u->width = u->acc;
if (!u->acc)
return LWS_SRET_FATAL + 18;
u->of++;
u->sctr = 0;
}
@ -462,7 +464,7 @@ lws_upng_decode(lws_upng_t* u, const uint8_t **_pos, size_t *_size)
u->u.y = 0;
u->u.ibp = 0;
u->u.bypp = (u->u.bpp + 7) / 8;
u->inf.bypl = u->u.bypl = u->width * u->u.bypp;
u->inf.bypl = u->u.bypl = u->width * u->u.bypp;
u->inf.outlen = u->inf.info_size;
u->inf.outpos = 0;