1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

164 Commits

Author SHA1 Message Date
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
Paul B Mahol
8a1759ad46 avcodec/exr: export writer info into frame metadata
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-01-19 21:06:34 +01:00
Paul B Mahol
546e29d1f5 avcodec/exr: make it aware of 2 additional compressions
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-01-19 21:06:34 +01:00
Kevin Wheatley
09905c412d libavcodec/exr: Fix blank output when data window != display window
looks like there is a bug in commit
1a08758e7c relating to the handling of
ptr in decode_frame after decode_block is called, before this commit
ptr would have been incremented for each line in the data window, now
after the commit it is left at the start of the first included line
rather than the line after the data window then the code sets the
remaining lines to 0 and thus the whole image is over written.

Fix by adjusting ptr to the correct line after decode_block returns

Signed-off-by: Kevin Wheatley <kevin.j.wheatley@gmail.com>
2017-01-06 18:01:12 +01:00
Martin Vignali
5099c541bb libavcodec/exr: add support for uint32 channel decoding with pxr24
Doesn't decode the uint32 layer, but decodes the half part of the file.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-25 00:57:38 +01:00
Martin Vignali
52da3f6f70 libavcodec/exr : fix channel size calculation for uint32 channel
uint32 need 4 bytes not 1.
Fix decoding when there is half/float and uint32 channel.

This fixes crashes due to pointer corruption caused by invalid writes.

The problem was introduced in commit
03152e74df.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-16 23:45:44 +01:00
Andreas Cadhalpun
ce3147eb19 exr: reindent after previous commit
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-16 22:37:24 +01:00
Andreas Cadhalpun
ffdc5d09e4 exr: fix out-of-bounds read
channel_index can be -1.

This problem was introduced in commit
2dd7b46132.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-16 22:37:17 +01:00
Michael Niedermayer
01aee8148d avcodec/exr: Check tile positions
This also disabled the case of mixed x/ymin with tiles, the code
handles these cases inconsistent for the 2 coordinate axis and is
unlikely working correctly.

Fixes crash
Fixes: poc1.exr, poc2.exr

Found-by: Yaoguang Chen of Aliapy unLimit Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-25 02:40:59 +02:00
Martin Vignali
f2b08a0702 libavcodec/exr : cosmetics, rename variable in b44_uncompress func
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-13 14:56:27 +02:00
Michael Niedermayer
b450b82514 avcodec/exr: Fix mixed declarations and statements
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-07 14:53:01 +02:00
Martin Vignali
50747d6b1f libavcodec/exr : indent gray support patch
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-06 23:53:28 +02:00
Martin Vignali
7ebd13fc8b libavodec/exr : add support for Y and YA file (ticket #5621)
a gray channel in exr, is named Y
we admit that the file need to be interpreted as gray
only if no other channel match (except alpha)

to manage RGB and Y in the color conversion part of decode_block,
the color processing is now made with a for loop.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-06 23:52:49 +02:00
Martin Vignali
d9e1e08133 libavcodec/exr : fix decoding piz float file.
fix ticket #5674

the size of data to process in piz_uncompress, is now calc
using the pixel type of each channel.

the data reorganization, alos take care about the size of
each channel

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-30 12:16:52 +02:00