aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-17 00:27:55 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-02-17 00:27:55 +0000
commit24fd683d6ba4931222d1141ec4978566b592c813 (patch)
tree46962e45d89ad2bd8d4d0f7e69c5edda964ee154
parent42d4badd92b218049cc3fb902256179a6bcd1841 (diff)
parentd50fb9c672dbbd0d5856dbb1b7acda60dd68418f (diff)
downloadqemu-snap-temp-L26100000958664537.tar.gz
Merge "sws_getContext will crash if given AV_PIX_FMT_NONE." into snap-temp-L26100000958664537snap-temp-L26100000958664537
-rw-r--r--android/android-emu/android/skin/qt/video-player/VideoInfo.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/android/android-emu/android/skin/qt/video-player/VideoInfo.cpp b/android/android-emu/android/skin/qt/video-player/VideoInfo.cpp
index 031a3e4c28..20581584e0 100644
--- a/android/android-emu/android/skin/qt/video-player/VideoInfo.cpp
+++ b/android/android-emu/android/skin/qt/video-player/VideoInfo.cpp
@@ -130,6 +130,11 @@ void VideoInfo::initialize() {
// create image convert context
AVPixelFormat dst_fmt = AV_PIX_FMT_RGB24;
+ // sws_getContext will crash if videoCodecCtx is AV_PIX_FMT_NONE.
+ if (videoCodecCtx->pix_fmt == AV_PIX_FMT_NONE) {
+ derror("Video codec has invalid pixel format\n");
+ return;
+ }
SwsContext* imgConvertCtx = sws_getContext(
videoCodecCtx->width, videoCodecCtx->height, videoCodecCtx->pix_fmt,
dst_w, dst_h, dst_fmt, SWS_FAST_BILINEAR, NULL, NULL, NULL);