diff options
author | sfan5 <sfan5@live.de> | 2025-07-30 15:49:07 +0200 |
---|---|---|
committer | Zhao Zhili <zhilizhao@tencent.com> | 2025-07-31 19:54:58 +0800 |
commit | 1a61db9797f461cbc7dd3400fa77dec4000df24e (patch) | |
tree | 2787fbaf5089afa4a1dca8da27fab4bca30988f4 | |
parent | 2a49d05d1a92cd6454b4e6fc026a66b697c77e67 (diff) | |
download | ffmpeg-1a61db9797f461cbc7dd3400fa77dec4000df24e.tar.gz |
avformat/file: add missing null check in Android content resolver
openFileDescriptor() can return null in certain error conditions.
Signed-off-by: sfan5 <sfan5@live.de>
Reviewed-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
-rw-r--r-- | libavformat/file.c | 5 |
1 files changed, 5 insertions, 0 deletions
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); |