[FFmpeg-devel] [PATCH] avcodec/h264_ps: fix storage size for offset_for_ref_frame

James Almer jamrial at gmail.com
Tue Apr 16 21:10:43 EEST 2019


On 4/11/2019 12:10 AM, James Almer wrote:
> On 4/10/2019 3:30 PM, James Almer wrote:
>> The spec defines the valid range of values to be INT32_MIN + 1 to INT32_MAX, inclusive.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>> A good example of why making offsets and sizes of structs like this tied to the
>> ABI is not a good idea.
>>
>>  libavcodec/h264_ps.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/h264_ps.h b/libavcodec/h264_ps.h
>> index e967b9cbcf..9014326dfb 100644
>> --- a/libavcodec/h264_ps.h
>> +++ b/libavcodec/h264_ps.h
>> @@ -81,7 +81,7 @@ typedef struct SPS {
>>      uint32_t num_units_in_tick;
>>      uint32_t time_scale;
>>      int fixed_frame_rate_flag;
>> -    short offset_for_ref_frame[256]; // FIXME dyn aloc?
>> +    int32_t offset_for_ref_frame[256];
> 
> The doxy for get_se_golomb() doesn't mention the range of values it can
> handle, but seeing there's also a get_se_golomb_long(), I guess the
> relevant line in h264_ps.c should now use the latter instead?
> 

Ping.

Also, could use another pair of eyes to make sure other fields have an
storage type that can handle their defined range of valid values.


More information about the ffmpeg-devel mailing list