[FFmpeg-devel] [PATCH 2/3] ffmdec: cast state to unsigned for left shift
Nicolas George
george at nsup.org
Sat Jan 2 16:56:00 CET 2016
Le tridi 13 nivôse, an CCXXIV, Andreas Cadhalpun a écrit :
> This fixes ubsan runtime error: left shift by 8 places cannot be
> represented in type 'int'
>
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
> libavformat/ffmdec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
> index 7b2d0d7..3162354 100644
> --- a/libavformat/ffmdec.c
> +++ b/libavformat/ffmdec.c
> @@ -76,7 +76,7 @@ static int ffm_resync(AVFormatContext *s, int state)
> av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n");
> return -1;
> }
> - state = (state << 8) | avio_r8(s->pb);
> + state = ((unsigned)state << 8) | avio_r8(s->pb);
> }
> return 0;
> }
IMHO, it would be more correct to make state uint32_t (and id at the call
site possibly too).
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160102/53b959ee/attachment.sig>
More information about the ffmpeg-devel
mailing list