[FFmpeg-cvslog] avcodec/qdm2: Do not read out of array in fix_coding_method_array()

2019-07-08 Thread Michael Niedermayer
ffmpeg | branch: release/4.1 | Michael Niedermayer  | 
Mon Jun 24 01:01:02 2019 +0200| [e5c21ed6e35e1efc89b583c793fd64b8b53f93e3] | 
committer: Michael Niedermayer

avcodec/qdm2: Do not read out of array in fix_coding_method_array()

Instead we ask for a sample, its unclear what to do in this case.

Fixes: index 30 out of bounds for type 'int8_t [30][64]'
Fixes: 
15339/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5749441484554240

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit ae021c1239ec3bc0a30dc5a4720569071599ece4)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e5c21ed6e35e1efc89b583c793fd64b8b53f93e3
---

 libavcodec/qdm2.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 1397218bdd..44ff4fa6c6 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -408,7 +408,12 @@ static int fix_coding_method_array(int sb, int channels,
 }
 for (k = 0; k < run; k++) {
 if (j + k < 128) {
-if (coding_method[ch][sb + (j + k) / 64][(j + k) % 64] > 
coding_method[ch][sb][j]) {
+int sbjk = sb + (j + k) / 64;
+if (sbjk > 29) {
+SAMPLES_NEEDED
+continue;
+}
+if (coding_method[ch][sbjk][(j + k) % 64] > 
coding_method[ch][sb][j]) {
 if (k > 0) {
 SAMPLES_NEEDED
 //not debugged, almost never used

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/qdm2: Do not read out of array in fix_coding_method_array()

2019-07-08 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
Jun 24 01:01:02 2019 +0200| [ae021c1239ec3bc0a30dc5a4720569071599ece4] | 
committer: Michael Niedermayer

avcodec/qdm2: Do not read out of array in fix_coding_method_array()

Instead we ask for a sample, its unclear what to do in this case.

Fixes: index 30 out of bounds for type 'int8_t [30][64]'
Fixes: 
15339/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5749441484554240

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ae021c1239ec3bc0a30dc5a4720569071599ece4
---

 libavcodec/qdm2.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 1397218bdd..44ff4fa6c6 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -408,7 +408,12 @@ static int fix_coding_method_array(int sb, int channels,
 }
 for (k = 0; k < run; k++) {
 if (j + k < 128) {
-if (coding_method[ch][sb + (j + k) / 64][(j + k) % 64] > 
coding_method[ch][sb][j]) {
+int sbjk = sb + (j + k) / 64;
+if (sbjk > 29) {
+SAMPLES_NEEDED
+continue;
+}
+if (coding_method[ch][sbjk][(j + k) % 64] > 
coding_method[ch][sb][j]) {
 if (k > 0) {
 SAMPLES_NEEDED
 //not debugged, almost never used

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".