From 1a61db9797f461cbc7dd3400fa77dec4000df24e Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 30 Jul 2025 15:49:07 +0200 Subject: [PATCH] avformat/file: add missing null check in Android content resolver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit openFileDescriptor() can return null in certain error conditions. Signed-off-by: sfan5 Reviewed-by: Kacper Michajłow Signed-off-by: Zhao Zhili --- libavformat/file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/file.c b/libavformat/file.c index 6a66040b65..a6eceff58d 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -621,6 +621,11 @@ static int android_content_open(URLContext *h, const char *filename, int flags) ret = ff_jni_exception_check(env, 1, c); if (ret < 0) goto done; + if (!parcel_file_descriptor) { + av_log(c, AV_LOG_ERROR, "file descriptor is null\n"); + ret = AVERROR_EXTERNAL; + goto done; + } fd = (*env)->CallIntMethod(env, parcel_file_descriptor, jfields.detach_fd_id); ret = ff_jni_exception_check(env, 1, c);