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

Git pushed a commit to branch master
in repository ffmpeg.

commit c51a420b59f950528a5eeec9b953af1bd48be86c
Author:     Jun Zhao <[email protected]>
AuthorDate: Mon Mar 9 08:47:49 2026 +0800
Commit:     toots <[email protected]>
CommitDate: Wed Mar 18 02:08:09 2026 +0000

    doc/examples/hw_decode: check fopen return value for output file
    
    The output file fopen() result is not checked. If it fails (e.g.
    permission denied or invalid path), output_file is NULL and the
    subsequent fwrite() call will crash.
    
    Add a NULL check with an error message, consistent with the
    existing error handling pattern in this example.
    
    Signed-off-by: Jun Zhao <[email protected]>
---
 doc/examples/hw_decode.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/examples/hw_decode.c b/doc/examples/hw_decode.c
index 7c73d59d93..7ecb70b181 100644
--- a/doc/examples/hw_decode.c
+++ b/doc/examples/hw_decode.c
@@ -233,6 +233,10 @@ int main(int argc, char *argv[])
 
     /* open the file to dump raw data */
     output_file = fopen(argv[3], "w+b");
+    if (!output_file) {
+        fprintf(stderr, "Cannot open output file '%s'\n", argv[3]);
+        return -1;
+    }
 
     /* actual decoding and dump the raw data */
     while (ret >= 0) {

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

Reply via email to