Re: [FFmpeg-devel] [PATCH 6/6] lavc/pngenc: check malloc fail before using the pointer
On Sat, May 11, 2019 at 12:06 AM Jun Zhao wrote: > > From: Jun Zhao > > Need to check malloc fail before using the pointer > > Signed-off-by: Jun Zhao > --- > libavcodec/pngenc.c |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c > index 69b4495..d4d8dc8 100644 > --- a/libavcodec/pngenc.c > +++ b/libavcodec/pngenc.c > @@ -748,11 +748,11 @@ static int apng_encode_frame(AVCodecContext *avctx, > const AVFrame *pict, > original_bytestream_end = s->bytestream_end; > > temp_bytestream = av_malloc(original_bytestream_end - > original_bytestream); > -temp_bytestream_end = temp_bytestream + (original_bytestream_end - > original_bytestream); > if (!temp_bytestream) { > ret = AVERROR(ENOMEM); > goto fail; > } > +temp_bytestream_end = temp_bytestream + (original_bytestream_end - > original_bytestream); > > for (last_fctl_chunk.dispose_op = 0; last_fctl_chunk.dispose_op < 3; > ++last_fctl_chunk.dispose_op) { > // 0: APNG_DISPOSE_OP_NONE > -- > 1.7.1 Pushed, Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 6/6] lavc/pngenc: check malloc fail before using the pointer
From: Jun Zhao Need to check malloc fail before using the pointer Signed-off-by: Jun Zhao --- libavcodec/pngenc.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 69b4495..d4d8dc8 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -748,11 +748,11 @@ static int apng_encode_frame(AVCodecContext *avctx, const AVFrame *pict, original_bytestream_end = s->bytestream_end; temp_bytestream = av_malloc(original_bytestream_end - original_bytestream); -temp_bytestream_end = temp_bytestream + (original_bytestream_end - original_bytestream); if (!temp_bytestream) { ret = AVERROR(ENOMEM); goto fail; } +temp_bytestream_end = temp_bytestream + (original_bytestream_end - original_bytestream); for (last_fctl_chunk.dispose_op = 0; last_fctl_chunk.dispose_op < 3; ++last_fctl_chunk.dispose_op) { // 0: APNG_DISPOSE_OP_NONE -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".