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/5] avformat/aviobuf: set AVIOContext->error on bprint buffer ENOMEM
@ 2021-12-27  0:26 Marton Balint
  2021-12-27  0:26 ` [FFmpeg-devel] [PATCH 2/5] avformat/movenc: factorize data shifting Marton Balint
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Marton Balint @ 2021-12-27  0:26 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marton Balint

This makes sure the error condition is kept in AVIOContext even if the user
does not check the return value of avio_read_to_bprint or
ff_read_line_to_bprint.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/aviobuf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 29d4bd7510..6f8a822ee3 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -875,8 +875,10 @@ static int64_t read_string_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp,
     if (ret < 0)
         return ret;
 
-    if (!av_bprint_is_complete(bp))
+    if (!av_bprint_is_complete(bp)) {
+        s->error = AVERROR(ENOMEM);
         return AVERROR(ENOMEM);
+    }
 
     return bp->len;
 }
@@ -1351,8 +1353,10 @@ int avio_read_to_bprint(AVIOContext *h, AVBPrint *pb, size_t max_size)
         if (ret <= 0)
             return ret;
         av_bprint_append_data(pb, buf, ret);
-        if (!av_bprint_is_complete(pb))
+        if (!av_bprint_is_complete(pb)) {
+            h->error = AVERROR(ENOMEM);
             return AVERROR(ENOMEM);
+        }
         max_size -= ret;
     }
     return 0;
-- 
2.31.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] 12+ messages in thread

end of thread, other threads:[~2022-01-03 19:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27  0:26 [FFmpeg-devel] [PATCH 1/5] avformat/aviobuf: set AVIOContext->error on bprint buffer ENOMEM Marton Balint
2021-12-27  0:26 ` [FFmpeg-devel] [PATCH 2/5] avformat/movenc: factorize data shifting Marton Balint
2021-12-31 12:36   ` Andreas Rheinhardt
2021-12-27  0:26 ` [FFmpeg-devel] [PATCH 3/5] avformat/flvenc: use ff_format_shift_data for " Marton Balint
2021-12-27  0:26 ` [FFmpeg-devel] [PATCH 4/5] avformat/segafilmenc: use ff_format_shift_data for shifting Marton Balint
2021-12-31 12:30   ` Andreas Rheinhardt
2021-12-27  0:26 ` [FFmpeg-devel] [PATCH 5/5] avformat/utils: propagate return value of ff_format_io_close in ff_format_shift_data Marton Balint
2021-12-31 10:40 ` [FFmpeg-devel] [PATCH 1/5] avformat/aviobuf: set AVIOContext->error on bprint buffer ENOMEM Andreas Rheinhardt
2021-12-31 16:53   ` Marton Balint
2022-01-02 20:46     ` Marton Balint
2022-01-03  8:31       ` Andreas Rheinhardt
2022-01-03 19:18         ` Marton Balint

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