summaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2017-07-22 21:49:46 +0100
committerMark Thompson <sw@jkqxz.net>2017-07-22 21:51:26 +0100
commitf48efb14f9f9000ae8b62fd8e1ddb55d2b8cb1ea (patch)
tree2284e7750e52348cc77f6f6068a22d158c10698c /libavutil
parentd24a82d2e2b73ad363b3f8d24b64cbfae65e4459 (diff)
downloadffmpeg-streaming-f48efb14f9f9000ae8b62fd8e1ddb55d2b8cb1ea.zip
ffmpeg-streaming-f48efb14f9f9000ae8b62fd8e1ddb55d2b8cb1ea.tar.gz
pixdesc: Explicitly handle invalid arguments to av_find_best_pix_fmt_of_2()
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/pixdesc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 1983ce9..e606b8e 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2633,6 +2633,11 @@ enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, en
const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
int score1, score2;
+ if (!desc1) {
+ dst_pix_fmt = dst_pix_fmt2;
+ } else if (!desc2) {
+ dst_pix_fmt = dst_pix_fmt1;
+ } else {
loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
if(!has_alpha)
loss_mask &= ~FF_LOSS_ALPHA;
@@ -2649,6 +2654,7 @@ enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, en
} else {
dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
}
+ }
if (loss_ptr)
*loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
OpenPOWER on IntegriCloud