diff options
author | Simon Thelen <ffmpeg-dev@c-14.de> | 2018-04-03 14:41:33 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-07-15 19:25:36 +0200 |
commit | 03af6ab540ccf0987da27dab71cf65eb5aa6136d (patch) | |
tree | 5ad814354bb824c6681215a7e743104b1ca8cf03 | |
parent | 9ffbda72c768a97d017aef42261dd5d657d4af6f (diff) | |
download | ffmpeg-03af6ab540ccf0987da27dab71cf65eb5aa6136d.tar.gz |
avcodec/imgconvert: fix possible null pointer dereference
regression since 354b26a3945eadd4ed8fcd801dfefad2566241de
(cherry picked from commit 8c2c97403baf95d0facb53f03e468f023eb943e1)
(cherry picked from commit c1e172c2e14ef059dac632f7c67f081dfecd30dc)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/imgconvert.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 0abe6cdf48..2402718b1f 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -84,11 +84,12 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p int loss; for (i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++) { - loss = *loss_ptr; + loss = loss_ptr ? *loss_ptr : 0; best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, &loss); } - *loss_ptr = loss; + if (loss_ptr) + *loss_ptr = loss; return best; } |