mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-20 22:48:22 +00:00
* video/readers/jpeg.c (grub_jpeg_decode_huff_table): Loop over all
tables. Ignore non-last ac bit. (grub_jpeg_decode_quan_table): Likewise.
This commit is contained in:
1 parent
7e720a9bc1
commit
e550750546
2 files changed
+14
-1
No files matched your search
@@ -178,8 +178,10 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data)
|
||||
next_marker = data->file->offset;
|
||||
next_marker += grub_jpeg_get_word (data);
|
||||
|
||||
while (data->file->offset + sizeof (count) + 1 <= next_marker)
|
||||
{
|
||||
id = grub_jpeg_get_byte (data);
|
||||
ac = (id >> 4);
|
||||
ac = (id >> 4) & 1;
|
||||
id &= 0xF;
|
||||
if (id > 1)
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
@@ -213,6 +215,7 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data)
|
||||
|
||||
base <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (data->file->offset != next_marker)
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: extra byte in huffman table");
|
||||
@@ -229,6 +232,8 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data)
|
||||
next_marker = data->file->offset;
|
||||
next_marker += grub_jpeg_get_word (data);
|
||||
|
||||
while (data->file->offset + sizeof (data->quan_table[id]) + 1 <= next_marker)
|
||||
{
|
||||
id = grub_jpeg_get_byte (data);
|
||||
if (id >= 0x10) /* Upper 4-bit is precision. */
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
@@ -241,6 +246,8 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data)
|
||||
if (grub_file_read (data->file, &data->quan_table[id], 64) != 64)
|
||||
return grub_errno;
|
||||
|
||||
}
|
||||
|
||||
if (data->file->offset != next_marker)
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
"jpeg: extra byte in quantization table");
|
||||
|
||||
Reference in new issue
Block a user