[FFmpeg-cvslog] lavc/pngenc: check malloc fail before using the pointer
Jun Zhao
git at videolan.org
Sun May 12 09:53:50 EEST 2019
ffmpeg | branch: master | Jun Zhao <barryjzhao at tencent.com> | Fri May 10 22:28:38 2019 +0800| [1cc7e2630fecac0b91e28f402a02f7e268c9d156] | committer: Jun Zhao
lavc/pngenc: check malloc fail before using the pointer
Need to check malloc fail before using the pointer
Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1cc7e2630fecac0b91e28f402a02f7e268c9d156
---
libavcodec/pngenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 69b4495404..d4d8dc8b5e 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
More information about the ffmpeg-cvslog
mailing list