Commit 37f31f4e authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/fitsdec: Use lrint()

Fixes: fate-fitsdec-bitpix-64

Possibly Fixes: -nan is outside the range of representable values of type 'unsigned short'
Possibly Fixes: 17769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5678314672357376

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 4825d8a9
...@@ -279,7 +279,7 @@ static int fits_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -279,7 +279,7 @@ static int fits_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
for (j = 0; j < avctx->width; j++) { \ for (j = 0; j < avctx->width; j++) { \
t = rd; \ t = rd; \
if (!header.blank_found || t != header.blank) { \ if (!header.blank_found || t != header.blank) { \
*dst++ = ((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) * scale; \ *dst++ = lrint(((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) * scale); \
} else { \ } else { \
*dst++ = fitsctx->blank_val; \ *dst++ = fitsctx->blank_val; \
} \ } \
......
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
#codec_id 0: rawvideo #codec_id 0: rawvideo
#dimensions 0: 102x109 #dimensions 0: 102x109
#sar 0: 0/1 #sar 0: 0/1
0, 0, 0, 1, 22236, 0x34490902 0, 0, 0, 1, 22236, 0x24634517
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
#codec_id 0: rawvideo #codec_id 0: rawvideo
#dimensions 0: 77x173 #dimensions 0: 77x173
#sar 0: 0/1 #sar 0: 0/1
0, 0, 0, 1, 26642, 0x0ad2a46a 0, 0, 0, 1, 26642, 0xa9eec634
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
#codec_id 0: rawvideo #codec_id 0: rawvideo
#dimensions 0: 256x256 #dimensions 0: 256x256
#sar 0: 0/1 #sar 0: 0/1
0, 0, 0, 1, 131072, 0x7fb22427 0, 0, 0, 1, 131072, 0x3ecd0739
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
#codec_id 0: rawvideo #codec_id 0: rawvideo
#dimensions 0: 512x512 #dimensions 0: 512x512
#sar 0: 0/1 #sar 0: 0/1
0, 0, 0, 1, 524288, 0xc327ed23 0, 0, 0, 1, 524288, 0x6567ecb3
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
#codec_id 0: rawvideo #codec_id 0: rawvideo
#dimensions 0: 128x128 #dimensions 0: 128x128
#sar 0: 0/1 #sar 0: 0/1
0, 0, 0, 1, 16384, 0xd788a2d2 0, 0, 0, 1, 16384, 0x353dbacd
15e85a553bbd07783f92377ed369308b *tests/data/lavf/lavf.gray16be.fits 15e85a553bbd07783f92377ed369308b *tests/data/lavf/lavf.gray16be.fits
5184000 tests/data/lavf/lavf.gray16be.fits 5184000 tests/data/lavf/lavf.gray16be.fits
tests/data/lavf/lavf.gray16be.fits CRC=0x8b840cff tests/data/lavf/lavf.gray16be.fits CRC=0x8cdcbeb2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment