/* 2 bits + 3 bits = 5 bits KFGSHIFT */
pad->granuleshift = ((GST_READ_UINT8 (data + 40) & 0x03) << 3) +
(GST_READ_UINT8 (data + 41) >> 5);
+ if (pad->granuleshift >= 63) {
+ /* Granuleshift can't be greater than the storage size of a granule */
+ GST_WARNING ("Invalid granuleshift (%u >= 63)", pad->granuleshift);
+ return FALSE;
+ }
GST_LOG ("granshift: %d", pad->granuleshift);
pad->is_video = TRUE;
}
if (pad->granuleshift == G_MAXUINT32) {
pad->granuleshift = GST_READ_UINT8 (data + 28);
+ if (pad->granuleshift >= 63) {
+ /* Granuleshift can't be greater than the storage size of a granule */
+ GST_WARNING ("Invalid granuleshift (%u >= 63)", pad->granuleshift);
+ return FALSE;
+ }
}
start_granule = GST_READ_UINT64_LE (data + 16);
pad->granulerate_n = GST_READ_UINT64_LE (data + 12);
pad->granulerate_d = GST_READ_UINT64_LE (data + 20);
pad->granuleshift = data[28];
+ if (pad->granuleshift >= 63) {
+ /* Granuleshift can't be greater than the storage size of a granule */
+ GST_WARNING ("Invalid granuleshift (%u >= 63)", pad->granuleshift);
+ return FALSE;
+ }
GST_LOG ("sample rate: %d", pad->granulerate_n);
pad->n_header_packets = 3;
pad->granulerate_n = GST_READ_UINT32_LE (data + 24);
pad->granulerate_d = GST_READ_UINT32_LE (data + 28);
pad->granuleshift = GST_READ_UINT8 (data + 15);
+ if (pad->granuleshift >= 63) {
+ /* Granuleshift can't be greater than the storage size of a granule */
+ GST_WARNING ("Invalid granuleshift (%u >= 63)", pad->granuleshift);
+ return FALSE;
+ }
GST_LOG ("sample rate: %d", pad->granulerate_n);
pad->n_header_packets = GST_READ_UINT8 (data + 11);
h);
pad->granuleshift = GST_READ_UINT8 (data + 37);
+ if (pad->granuleshift >= 63) {
+ /* Granuleshift can't be greater than the storage size of a granule */
+ GST_WARNING ("Invalid granuleshift (%u >= 63)", pad->granuleshift);
+ return FALSE;
+ }
GST_LOG ("granshift: %d", pad->granuleshift);
pad->is_video = TRUE;