Open wrv opened 1 year ago
To produce the PoC video with H26Forge, you can use the following transform:
##
# Overflows a qs_y calculation, triggering potential issues while decoding
#
# Save this file as `overflowing_qs_y.py`
# Run with `./h26forge modify -i input_vids/SPS_PPS_I_P.264 -o overflowing_qs_y.264 -t overflowing_qs_y.py`
#
def overflow_qs_y(ds):
ds["ppses"][0]["pic_init_qs_minus26"] = -285
# SI slice
ds["slices"][0]["sh"]["slice_type"] = 4
ds["slices"][0]["sh"]["slice_qs_delta"] = -2147483645
return ds
def modify_video(ds):
return overflow_qs_y(ds)
https://github.com/dholroyd/h264-reader/blob/8cae2315eee5796b297a412d388c7cf797b386da/src/nal/slice/mod.rs#L602C74-L602C74
A missing bounds check in
pps.pic_init_qs_minus26
can cause an overflow when calculatingqs_y
.Here is an input with
pps.pic_init_qs_minus26
set to-285
andslice_qs_delta
set to-2147483645
:The syntax element
pps.pic_init_qs_minus26
should be in the range [-26, 25].Found with H26Forge.