1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-05 15:58:07 +02:00
Commit Graph

36 Commits

Author SHA1 Message Date
Andreas Rheinhardt
a247ac640d avcodec: Constify AVCodecs
Given that the AVCodec.next pointer has now been removed, most of the
AVCodecs are not modified at all any more and can therefore be made
const (as this patch does); the only exceptions are the very few codecs
for external libraries that have a init_static_data callback.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:15 -03:00
Michael Niedermayer
b3c25263d1 avcodec/scpr: Check minimum size of type 17
Improves: Timeout (85sec -> 46sec)
Improves: 17644/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5715704283660288

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>
2019-10-10 14:34:19 +02:00
James Almer
9ea6d2149e avcodec/decode: add a flags parameter to ff_reget_buffer()
Some decoders may not need a writable buffer in some specific cases, but only
a reference to the existing buffer with updated frame properties instead, for
the purpose of returning duplicate frames. For this, the
FF_REGET_BUFFER_FLAG_READONLY flag is added, which will prevent potential
allocations and buffer copies when they are not needed.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-04 10:07:12 -03:00
Michael Niedermayer
950a21e83c avcodec/scpr: Use av_memcpy_backptr() in type 17 and 33
This makes the changed code-path faster.

Change not tested except with the fuzzer testcase as I found no other testcase.

Improves: Timeout (136sec -> 74sec)
Improves: 16040/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5705876062601216

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
2019-08-11 19:13:21 +02:00
Marton Balint
1b4f74ffe2 avcodec/scpr: fix checking ret value of decode_run_i
Fixes Coverity CID 1441460.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-05-24 21:39:07 +02:00
Michael Niedermayer
6dd8420290 avcodec/scpr: check remaining data after decode
Fixes Timeout (29sec -> 14sec)
Fixes: 13713/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5756778069884928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-09 22:03:53 +02:00
Paul B Mahol
ea80af659c avcodec/scpr: avoid using uninitialized value
Fixes #7872.
2019-04-28 11:09:26 +02:00
Michael Niedermayer
8f63fa4c2e avcodec/scpr: Perform frame copy later
Optimization found while looking at 13442/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5758293933293568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-03-20 21:12:45 +01:00
Michael Niedermayer
53248acfb3 avcodec/scpr: Fix use of uninitialized variable
Fixes: Undefined shift
Fixes: 12911/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5677102915911680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-03-06 23:40:47 +01:00
Paul B Mahol
a064530da8 avcodec/scpr: add version 3 support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-11-18 22:59:29 +01:00
Michael Niedermayer
d702769213 avcodec/scpr: Skip frames which change nothing
Fixes: Timeout
Fixes: 10292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5687943864254464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-09-30 22:23:02 +02:00
Paul B Mahol
4b1b47e81b avcodec/scpr: stop checking for overread twice 2018-09-09 14:06:57 +02:00
Paul B Mahol
cc24665f44 avcodec/scpr: make sure count and min are valid 2018-09-07 15:09:40 +02:00
Paul B Mahol
ce8807c290 avcodec/scpr: refactor repeated code into decode_units() 2018-09-01 12:38:17 +02:00
Paul B Mahol
d71dfc087b avcodec/scpr: error out if run length is <= 0 2018-08-29 23:11:45 +02:00
Michael Niedermayer
3378194ce8 avcodec/scpr: Check for min > max in decompress_p()
Fixes: Timeout
Fixes: 9342/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-4795990841229312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-08-16 01:06:17 +02:00
Paul B Mahol
324954cf96 avcodec/scpr: fix decoding of prev+top-topleft prediction in keyframes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-02 16:05:23 +02:00
Paul B Mahol
22a878ecd1 avcodec/scpr: check for possible out of array access
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-02 09:02:25 +02:00
Michael Niedermayer
0fb33a8289 avcodec/scpr: Fix reading a pixel before the first
Fixes: 5540/clusterfuzz-testcase-minimized-6122458273808384

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-11 02:49:15 +01:00
Michael Niedermayer
981f04b2ae avcodec/scpr: optimize shift loop.
Speeds code up from 50sec to 15sec

Fixes Timeout
Fixes: 3242/clusterfuzz-testcase-5811951672229888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-10 19:08:23 +02:00
Derek Buitenhuis
f7daed8545 scpr: Added missing error check
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-07-07 15:25:46 -04:00
Michael Niedermayer
5666b95c9f avcodec/scpr: mask bits to prevent out of array read
Fixes: 1615/clusterfuzz-testcase-minimized-6625214647500800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-16 23:14:28 +02:00
Michael Niedermayer
2171dfae8c avcodec/scpr: Fix multiple runtime error: index 256 out of bounds for type 'unsigned int [256]'
Fixes: 1519/clusterfuzz-testcase-minimized-5286680976162816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-13 15:54:33 +02:00
Michael Niedermayer
7ac5067146 avcodec/scpr: Check y in first line loop in decompress_i()
Fixes: out of array access
Fixes: 1478/clusterfuzz-testcase-minimized-5285486908145664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-11 15:51:08 +02:00
Michael Niedermayer
f1a4dd5e48 avcodec/scpr: Fix multiple runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 1422/clusterfuzz-testcase-minimized-5030993939398656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-09 19:46:17 +02:00
Paul B Mahol
807d5dcde9 avcodec/scpr: use correct linesize for prev frame
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-03-12 12:34:55 +01:00
Paul B Mahol
6d93e7d1a3 avcodec/scpr: fix top left prediction for special case when x is 0 for keyframes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-03-03 12:28:24 +01:00
Paul B Mahol
86ab6b6e08 avcodec/scpr: check if total_freq is 0 in decode0
Fixes SIGFPE, closes #6196.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-27 13:55:15 +01:00
Paul B Mahol
6d856b2579 avcodec/scpr: add support for older version
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-26 22:09:54 +01:00
Paul B Mahol
e01c32f260 avcodec/scpr: remove 4 dead store
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-24 19:49:39 +01:00
Paul B Mahol
0a28c50506 avcodec/scpr: improve motion vectors checking for out of buffer write
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-24 15:27:19 +01:00
Paul B Mahol
178cd50c47 avcodec/scpr: make sure that component value is <= 0x1F for 16 bpc
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-24 12:02:48 +01:00
Paul B Mahol
45ed942e7e avcodec/scpr: improve check for out of range motion vectors
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-23 19:45:12 +01:00
Paul B Mahol
95a5af446b avcodec/scpr: check that current row is in valid range
Stops writing out of dst array.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-23 18:46:24 +01:00
Paul B Mahol
fd7af82c53 avcodec/scpr: do not allow out of array access for 16bit case
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-23 17:22:01 +01:00
Paul B Mahol
039011b6b0 avcodec: add ScreenPressor decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-22 22:57:59 +01:00