This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit e626b02a01093b90fe6ab0d3a3d3acbf094b0b91
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Mon May 11 16:53:37 2026 +0200
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Tue May 12 16:11:56 2026 +0200

    avformat/id3v2: Avoid temporary buffer
    
    Reviewed-by: Romain Beauxis <[email protected]>
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavformat/id3v2.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 44cad17d8b..66036fbdfc 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -1057,18 +1057,19 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary 
**metadata,
 #endif
             if (s && (s->debug & FF_FDEBUG_ID3V2)) {
                 int64_t pos = avio_tell(pbx);
-                uint8_t *buf = av_malloc(tlen);
+                uint8_t *buf = av_malloc(tlen + 3U);
                 if (buf) {
-                    AVBPrint bp;
-                    int n = avio_read(pbx, buf, tlen);
-                    av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
-                    av_bprintf(&bp, "|");
-                    for (int i = 0; i < n; i++)
-                        av_bprintf(&bp, "%c", buf[i] >= 0x20 && buf[i] < 0x7f 
? buf[i] : '.');
-                    av_bprintf(&bp, "|");
-                    av_log(NULL, AV_LOG_INFO, "ID3v2 frame %.4s (%d 
bytes):%s\n",
-                           tag, tlen, bp.str);
-                    av_bprint_finalize(&bp, NULL);
+                    int n = avio_read(pbx, buf + 1, tlen);
+                    if (n >= 0) {
+                        buf[0] = '|';
+                        for (unsigned i = 1; i <= n; i++)
+                            if (!(buf[i] >= 0x20 && buf[i] < 0x7f))
+                                buf[i] = '.';
+                        buf[n + 1] = '|';
+                        buf[n + 2] = '\0';
+                        av_log(NULL, AV_LOG_INFO, "ID3v2 frame %.4s (%d 
bytes):%s\n",
+                               tag, tlen, buf);
+                    }
                     av_free(buf);
                     avio_seek(pbx, pos, SEEK_SET);
                 }

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to