Avoid buffer overflows decoding images. On compression we compute
lengths till end of line so it won't cause regressions.
Proved by fuzzing the code.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
Gbp-Pq: Name CVE-2020-14355_part3.patch
channel->state.waitcnt = stopidx - i;
run_index = i;
#ifdef RLE_STAT
- run_end = i + decode_channel_run(encoder, channel);
+ run_end = decode_channel_run(encoder, channel);
#else
- run_end = i + decode_run(encoder);
+ run_end = decode_run(encoder);
#endif
+ if (run_end < 0 || run_end > (end - i)) {
+ encoder->usr->error(encoder->usr, "wrong RLE\n");
+ }
+ run_end += i;
+
for (; i < run_end; i++) {
cur_row[i].a = cur_row[i - 1].a;
}