Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/7] avcodec/pnmenc: Check av_image_get_buffer_size()
@ 2022-11-19  2:57 Andreas Rheinhardt
  2022-11-19  2:59 ` [FFmpeg-devel] [PATCH 2/7] avcodec/flashsvenc: Account for header in packet size Andreas Rheinhardt
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Andreas Rheinhardt @ 2022-11-19  2:57 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Fixes the crash in ticket #10050.
Also ensure that we don't overflow before ff_get_encode_buffer().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/pnmenc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c
index 9eb663306d..c998dd410c 100644
--- a/libavcodec/pnmenc.c
+++ b/libavcodec/pnmenc.c
@@ -42,7 +42,10 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     int size = av_image_get_buffer_size(avctx->pix_fmt,
                                         avctx->width, avctx->height, 1);
 
-    if ((ret = ff_get_encode_buffer(avctx, pkt, size + 200, 0)) < 0)
+    if (size < 0)
+        return size;
+
+    if ((ret = ff_get_encode_buffer(avctx, pkt, size + 200U, 0)) < 0)
         return ret;
 
     bytestream_start =
-- 
2.34.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-11-21  0:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-19  2:57 [FFmpeg-devel] [PATCH 1/7] avcodec/pnmenc: Check av_image_get_buffer_size() Andreas Rheinhardt
2022-11-19  2:59 ` [FFmpeg-devel] [PATCH 2/7] avcodec/flashsvenc: Account for header in packet size Andreas Rheinhardt
2022-11-21  0:17   ` James Almer
2022-11-19  2:59 ` [FFmpeg-devel] [PATCH 3/7] avcodec/flashsvenc: Remove unused buffer Andreas Rheinhardt
2022-11-19  2:59 ` [FFmpeg-devel] [PATCH 4/7] avcodec/flashsvenc: Use const where appropriate Andreas Rheinhardt
2022-11-19  2:59 ` [FFmpeg-devel] [PATCH 5/7] avcodec/flashsvenc: Change check for first frame Andreas Rheinhardt
2022-11-19  2:59 ` [FFmpeg-devel] [PATCH 6/7] avcodec/flashsvenc: Avoid copying frame Andreas Rheinhardt
2022-11-21  0:08   ` [FFmpeg-devel] [PATCH v2 " Andreas Rheinhardt
2022-11-19  2:59 ` [FFmpeg-devel] [PATCH 7/7] avcodec/flashsvenc: Avoid unnecessary variable Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git