Commit Graph

177 Commits

Author SHA1 Message Date
Michael Niedermayer
312bcdbfc1 avcodec/exr: Check col/line for integer overflow
Fixes: signed integer overflow: -2272 + -2147483360 cannot be represented in type 'int'
Fixes: 30009/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5005660322398208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-13 21:02:31 +01:00
Paul B Mahol
6cc3ba4be6 avcodec/exr: add lut oriented half to float conversion code 2021-03-02 20:53:04 +01:00
Paul B Mahol
cc85ca1cb3 avcodec/exr: add DWA decompression support 2021-03-02 20:53:04 +01:00
Andreas Rheinhardt
0e645b98c6 Remove double ';'
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:10:44 +01:00
Paul B Mahol
4cb989e836 avcodec/exr: add fast path for case when powf() isn't needed 2021-02-28 23:19:01 +01:00
Paul B Mahol
85ab9deb98 avcodec/exr: handle case when |im - IM| == 1 for huff compression 2021-02-28 02:06:02 +01:00
Paul B Mahol
767d3f7dcf avcodec/exr: simplify piz decompression
Note that >32 codes are no longer supported, give
proper error code if such scenario ever happens.
2021-02-24 17:10:14 +01:00
Paul B Mahol
8d209eb33c avcodec/exr: export any unknown header string variable to metadata
And properly skip preview type in header.
2021-02-16 14:39:43 +01:00
Paul B Mahol
f5dde8089d avcodec/exr: refactor GetByteContext usage 2021-02-16 13:58:48 +01:00
Paul B Mahol
3ea660c78a avcodec/exr: correctly calculate display window 2021-02-16 13:58:48 +01:00
Paul B Mahol
b1eb15c1cf avcodec/exr: add multipart support 2021-02-16 03:51:07 +01:00
Paul B Mahol
5f0e3b549a avcodec/exr: unbreak parsing sample aspect ratio 2021-02-15 17:39:35 +01:00
Paul B Mahol
98191135e0 avcodec/exr: read fps from metadata too 2021-02-15 17:39:35 +01:00
Mark Reid
8d19b3c4a5 avcodec/exr: preserve half-float NaN bits and add fate test
Handles NaNs more like the official implementation handles them, preserving
the original bits.
2020-12-09 12:31:09 +01:00
Michael Niedermayer
b0a8b40294 avcodec/exr: skip bottom clearing loop when its outside the image
Fixes: signed integer overflow: 1633771809 * 32960 cannot be represented in type 'int'
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-11-22 17:45:17 +01:00
Michael Niedermayer
3e5959b345 avcodec/exr: Check ymin vs. h
Fixes: out of array access
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
Fixes: 27443/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5631239813595136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-11-22 17:45:17 +01:00
Mark Reid
dd03d65540 avcodec/exr: use lookuptable for alpha if there is no trc_func
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2020-11-20 15:20:24 +01:00
Michael Niedermayer
6910e0f4e5 avcodec/exr: Check limits to avoid overflow in delta computation
Fixes: signed integer overflow: 553590816 - -2145378049 cannot be represented in type 'int'
Fixes: 26315/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5938755121446912
Fixes: 26340/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5644316208529408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-20 15:33:13 +02:00
Michael Niedermayer
7265b7d904 avcodec/exr: Fix overflow with many blocks
Fixes: signed integer overflow: 1073741827 * 8 cannot be represented in type 'int'
Fixes: 25621/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6304841641754624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-15 23:38:58 +02:00
Michael Niedermayer
9b72cea446 avcodec/exr: Check line size for overflow
Fixes: signed integer overflow: 570425356 * 6 cannot be represented in type 'int
Fixes: 25929/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5099197739827200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-11 16:42:49 +02:00
Michael Niedermayer
6949df35d0 avcodec/exr: Check xdelta, ydelta
Fixes: assertion failure
Fixes: 25617/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5648746061496320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-11 16:42:49 +02:00
Mark Reid
8ddcbebc3f libavcodec/exr: fix incorrect translation of denorm mantissa 2020-09-15 19:22:18 +02:00
Paul B Mahol
a406dde1d2 avcodec/exr: initialize axmax and bxmin to 0
They can be used uninitialized.
2020-09-12 10:09:18 +02:00
Mark Reid
1c094563fe avcodec/exr: add support data windows larger or outside display window 2020-09-12 01:34:51 +02:00
Mark Reid
af5922a79a avcodec/exr: output float pixels in float pixel format
changes since v1
- default behavior, no longer hidden behind decoder parameter
- updated tests to reflect change

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-20 15:47:22 +02:00
Anton Khirnov
1f4cf92cfb pthread_frame: merge the functionality for normal decoder init and init_thread_copy
The current design, where
- proper init is called for the first per-thread context
- first thread's private data is copied into private data for all the
  other threads
- a "fixup" function is called for all the other threads to e.g.
  allocate dynamically allocated data
is very fragile and hard to follow, so it is abandoned. Instead, the
same init function is used to init each per-thread context. Where
necessary, AVCodecInternal.is_copy can be used to differentiate between
the first thread and the other ones (e.g. for decoding the extradata
just once).
2020-04-10 15:24:54 +02:00
Paul B Mahol
2bae3da79e avcodec/exr: fix some small cosmetics nits 2020-01-22 10:43:49 +01:00
Gonzalo Garramuño
44b1c5ddcf avcodec/exr.c: make channel name comparisons case insensitive
Allow matching channel names in lowercase, like Diffuse.r in addition to Diffuse.R
2020-01-22 10:43:49 +01:00
Michael Niedermayer
080819b3b4 avcodec/exr: Allow duplicate use of channel indexes
Fixes: Ticket #8203

Reported-by: durandal_1707
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-10 14:34:19 +02:00
Andreas Rheinhardt
8b0f949906 avcodec/exr: Fix undefined left shifts of negative numbers
Affected the FATE-tests exr-rgb-scanline-pxr24-half-uint32-13x9 and
exr-rgb-scanline-pxr24-uint32.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-26 21:02:34 +02:00
Limin Wang
3104100a12 avcodec/exr: cosmetics
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-23 22:16:00 +02:00
Michael Niedermayer
433d2ae435 avcodec/exr: set layer_match in all branches
Otherwise it is left to the value from the previous iteration

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-12 16:46:41 +01:00
Michael Niedermayer
f9728feaf9 avcodec/exr: Check for duplicate channel index
Fixes: Out of memory
Fixes: 11582/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5730204559867904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-12 16:46:41 +01:00
Michael Niedermayer
49062a9017 avcodec/exr: fix invalid shift in unpack_14()
Fixes: 6154/clusterfuzz-testcase-minimized-5762231061970944
Fixes: runtime error: shift exponent 63 is too large for 32-bit type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-27 19:37:06 +01:00
Martin Vignali
ea03f295ec avcodec/exr : add support for long name flag and be more explicit about unsupported flag
based-on patch by Carl Eugen Hoyos

Fix ticket 6994
2018-02-24 21:42:04 +01:00
Michael Niedermayer
dd8351b118 avcodec/exr: Check remaining bits in last get code loop
Fixes: runtime error: shift exponent -7 is negative
Fixes: 3902/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6081926122176512

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-17 15:56:59 +01:00
Michael Niedermayer
0a2560a977 avcodec/exr: Fix memleaks in decode_header()
Fixes: 4793/clusterfuzz-testcase-minimized-5707366629638144

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-02 00:18:24 +01:00
Michael Niedermayer
903be5e4f6 avcodec/exr: Check buf_size more completely
Fixes: Out of heap array read
Fixes: 4683/clusterfuzz-testcase-minimized-6152313673613312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-12-30 21:02:49 +01:00
Michael Niedermayer
66f0c958bf avcodec/exr: fix undefined shift in pxr24_uncompress()
Fixes: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
Fixes: 3787/clusterfuzz-testcase-minimized-5728764920070144

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-05 03:12:35 +01:00
Martin Vignali
ac5908b13f libavcodec/exr : add x86 SIMD for predictor
Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-01 17:35:30 -03:00
James Almer
98d7ad085e avcodec/exrdsp: improve the ExrDSPContext->reorder_pixels prototype
Make dst be the first parameter and src const. It's more in line with the rest of the codebase.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-09-17 19:01:40 -03:00
Martin Vignali
9b8c1224d7 libavcodec/exr : add X86 SIMD for reorder_pixels
Signed-off-by: James Almer <jamrial@gmail.com>
2017-09-17 17:53:57 -03:00
Martin Vignali
2c6179aa82 libavcodec/exr : simplify reorder_pixels
reorder_pixels is call by rle_uncompress and zip_uncompress
with size == uncompress_size

uncompress_size is a multiple of 2 (because exr store data
in half, float, or uint32)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-14 20:58:53 +02:00
Martin Vignali
73ae60d7df libavcodec/exr : cosmetics variable name
rename tile variable to better follow ffmpeg coding style

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-12 23:38:03 +02:00
Martin Vignali
37f4d22075 libavcodec/exr : fix piz uncompress on big endian
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-01 11:40:57 +02:00
Martin Vignali
e46d637452 libavcodec/exr : fix float to uint16 conversion for negative float value
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-27 04:25:31 +02:00
Muhammad Faiz
31f61b0d4f avcodec: do not use AVFrame accessor
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-04-23 14:27:47 +07:00
Martin Vignali
8163314967 libavcodec/exr : fix scanline offset table recreation on big endian
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-03 03:02:50 +02:00
Dzung Hoang
68e3c9a3b6 avcodec/exr: add support for scanline file where offsets are set to zero 2017-04-01 17:57:59 +02:00
Martin Vignali
b4016ef31a avcodec/exr: add support for uint32 2017-03-29 23:28:35 +02:00