aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Thelen <ffmpeg-dev@c-14.de>2018-04-03 14:41:33 +0200
committerPaul B Mahol <onemda@gmail.com>2018-04-03 16:20:31 +0200
commit8c2c97403baf95d0facb53f03e468f023eb943e1 (patch)
tree023737406d078e58ec820126de11748acc6d3f9e
parent4b736bc921ed96ad6d312ce0cbe0de29b9e3fe81 (diff)
downloadffmpeg-8c2c97403baf95d0facb53f03e468f023eb943e1.tar.gz
avcodec/imgconvert: fix possible null pointer dereference
regression since 354b26a3945eadd4ed8fcd801dfefad2566241de
-rw-r--r--libavcodec/imgconvert.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 7b0005b308..1fd636c83d 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -72,11 +72,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;
}