Commit 5430e9d995 for aom
commit 5430e9d99504a98636c174f40fddf91c30b85d0c
Author: Wan-Teh Chang <wtc@google.com>
Date: Thu Aug 6 13:54:29 2026 -0700
Check fopen failure in print_reconstruction_frame
Fix Coverity defect CID 561345 Dereference null return value.
Change-Id: I0b7f37c6adc6b9ec478404a3e1a45224fee4a397
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 30d3522c33..bbd5b2d796 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -12,6 +12,7 @@
#include <limits.h>
#include <math.h>
#include <stdio.h>
+#include <stdlib.h>
#include "config/aom_dsp_rtcd.h"
#include "config/aom_scale_rtcd.h"
@@ -1046,6 +1047,11 @@ static void print_reconstruction_frame(
recon_file = fopen(filename, "ab");
}
+ if (!recon_file) {
+ fprintf(stderr, "%s: fopen(\"%s\") failed", __func__, filename);
+ abort();
+ }
+
fwrite(last_frame->buffer_alloc, last_frame->frame_size, 1, recon_file);
fclose(recon_file);
}