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

Git pushed a commit to branch master
in repository ffmpeg.

commit 39d8be775451d206771424236b02a7e56398fe2c
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Thu Oct 15 02:02:02 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Sun Oct 18 03:19:28 2026 +0000

    avformat: report a failed allocation of a directory entry name
    
    The file, ftp and libssh protocols returned the entry without a name
    when duplicating the name failed.
    
    Assisted-by: Claude
---
 libavformat/file.c   | 2 +-
 libavformat/ftp.c    | 5 +++--
 libavformat/libssh.c | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/file.c b/libavformat/file.c
index bb99198a6a..79c6ed88df 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -416,7 +416,7 @@ static int file_read_dir(URLContext *h, AVIODirEntry **next)
     }
 
     (*next)->name = av_strdup(dir->d_name);
-    return 0;
+    return (*next)->name ? 0 : AVERROR(ENOMEM);
 #else
     return AVERROR(ENOSYS);
 #endif /* HAVE_LSTAT */
diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 3865177f99..67eecc5661 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -994,7 +994,7 @@ static int64_t ftp_parse_date(const char *date)
 static int ftp_parse_entry_nlst(char *line, AVIODirEntry *next)
 {
     next->name = av_strdup(line);
-    return 0;
+    return next->name ? 0 : AVERROR(ENOMEM);
 }
 
 static int ftp_parse_entry_mlsd(char *mlsd, AVIODirEntry *next)
@@ -1005,7 +1005,8 @@ static int ftp_parse_entry_mlsd(char *mlsd, AVIODirEntry 
*next)
     while(fact = av_strtok(p, ";", &saveptr)) {
         p = NULL;
         if (fact[0] == ' ') {
-            next->name = av_strdup(&fact[1]);
+            if (!(next->name = av_strdup(&fact[1])))
+                return AVERROR(ENOMEM);
             continue;
         }
         fact = av_strtok(fact, "=", &value);
diff --git a/libavformat/libssh.c b/libavformat/libssh.c
index 470175924d..2b219a8362 100644
--- a/libavformat/libssh.c
+++ b/libavformat/libssh.c
@@ -420,7 +420,7 @@ static int libssh_read_dir(URLContext *h, AVIODirEntry 
**next)
         entry->type = AVIO_ENTRY_UNKNOWN;
     }
     sftp_attributes_free(attr);
-    return 0;
+    return entry->name ? 0 : AVERROR(ENOMEM);
 }
 
 static int libssh_close_dir(URLContext *h)

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to