* 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:
parent
7e720a9bc1
commit
e550750546
2 changed files with 14 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2010-05-05 Peter Hurley <No e-mail available> (tiny change)
|
||||
|
||||
* video/readers/jpeg.c (grub_jpeg_decode_huff_table): Loop over all
|
||||
tables. Ignore non-last ac bit.
|
||||
(grub_jpeg_decode_quan_table): Likewise.
|
||||
|
||||
2010-05-05 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New value
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue