[FFmpeg-devel] [PATCH 1/2] avcodec/h264_ps: Fix runtime error: signed integer overflow: 2147483647 + 26 cannot be represented in type 'int'

Michael Niedermayer michael at niedermayer.cc
Thu Mar 23 16:24:04 EET 2017


On Wed, Mar 22, 2017 at 08:45:59AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Tue, Mar 21, 2017 at 9:59 PM, Michael Niedermayer <michael at niedermayer.cc
> > wrote:
> 
> > Fixes: 902/clusterfuzz-testcase-4561155144024064
> >
> > Found-by: continuous fuzzing process https://github.com/google/oss-
> > fuzz/tree/master/targets/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/h264_ps.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> > index 65d164d81c..b78ad251f5 100644
> > --- a/libavcodec/h264_ps.c
> > +++ b/libavcodec/h264_ps.c
> > @@ -800,8 +800,8 @@ int ff_h264_decode_picture_parameter_set(GetBitContext
> > *gb, AVCodecContext *avct
> >
> >      pps->weighted_pred                        = get_bits1(gb);
> >      pps->weighted_bipred_idc                  = get_bits(gb, 2);
> > -    pps->init_qp                              = get_se_golomb(gb) + 26 +
> > qp_bd_offset;
> > -    pps->init_qs                              = get_se_golomb(gb) + 26 +
> > qp_bd_offset;
> > +    pps->init_qp                              = get_se_golomb(gb) + 26U +
> > qp_bd_offset;
> > +    pps->init_qs                              = get_se_golomb(gb) + 26U +
> > qp_bd_offset;
> >      pps->chroma_qp_index_offset[0]            = get_se_golomb(gb);
> >      if (pps->chroma_qp_index_offset[0] < -12 ||
> > pps->chroma_qp_index_offset[0] > 12) {
> >          ret = AVERROR_INVALIDDATA;
> > --
> > 2.11.0
> 
> 
> OK.

applied

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170323/ded87238/attachment.sig>


More information about the ffmpeg-devel mailing list