Daniel Axtens 34b85a6e07 video/readers/jpeg: Catch OOB reads/writes in grub_jpeg_decode_du()
The key line is:

  du[jpeg_zigzag_order[pos]] = val * (int) data->quan_table[qt][pos];

jpeg_zigzag_order is grub_uint8_t[64].

I don't understand JPEG decoders quite well enough to explain what's
going on here. However, I observe sometimes pos=64, which leads to an
OOB read of the jpeg_zigzag_order global then an OOB write to du.
That leads to various unpleasant memory corruption conditions.

Catch where pos >= ARRAY_SIZE(jpeg_zigzag_order) and bail.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2021-03-02 15:54:18 +01:00
..
2020-07-29 16:55:47 +02:00
2020-09-11 15:45:56 +02:00
2020-07-29 16:55:47 +02:00
2015-01-27 17:17:58 +01:00
2011-05-16 02:34:58 +02:00
2010-08-19 16:54:00 +05:30