Skip to content

Commit 888d2e7

Browse files
committed
[Encode] VP9 Encode Fix file colums calculation
When picParam->log2_tile_columns is 0 and min_log2_tile_cols is 1 then Vp9WriteUncompressHeader will crash will while loop. col_data will be -1 and while loop will be huze and potentially crash or unknow behaviour. To avoid this added a boundary check to fix this issue. Signed-off-by: sachin kumar <[email protected]>
1 parent 159463e commit 888d2e7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

media_softlet/linux/common/codec/ddi/enc/media_libvpx_vp9_next.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,15 @@ bool Vp9WriteUncompressHeader(encode::DDI_ENCODE_CONTEXT *ddiEncContext,
449449
min_log2_tile_cols = get_min_log2_tile_cols(sb_cols);
450450
max_log2_tile_cols = get_max_log2_tile_cols(sb_cols);
451451

452-
col_data = picParam->log2_tile_columns - min_log2_tile_cols;
452+
if (picParam->log2_tile_columns < min_log2_tile_cols)
453+
{
454+
col_data = 0;
455+
}
456+
else
457+
{
458+
col_data = picParam->log2_tile_columns - min_log2_tile_cols;
459+
}
460+
453461
while (col_data--)
454462
{
455463
vp9_wb_write_bit(wb, 1);

0 commit comments

Comments
 (0)