[FFmpeg-devel] [PATCH 10/11] avcodec/h264_parser: zero-initialize H264PredWeightTable

Timo Rothenpieler timo at rothenpieler.org
Sun Jun 11 18:12:19 EEST 2017

> Seems dubious?  That is not a small structure, and it's being used essentially write-only here to skip over an unwanted part of the slice header - since it will only ever write to a small proportion of the elements, initialising all of them to zero feels like a waste.
> (The only argument in Coverity seems to be that passing a pointer to an uninitialised structure to an external function is bad - it hasn't actually looked at the function to observe that it doesn't read anything currently in the structure.)

It calls ff_h264_pred_weight_table in line 204, which it does analyze, 
and which accesses pwt->chroma_log2_weight_denom, which was not 
initialized before.
I don't think doing = { 0 }; is expensive. iirc all elements except for 
the first one are zero-initialized already, even though it's 
implementation-defined or even undefined.

More information about the ffmpeg-devel mailing list