From 81bb838ef7ce492a3ea9d097a781ae1ed7f318b9 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 7 Feb 2018 23:45:46 +0900 Subject: [PATCH] frames: Bug fix: crash at *Frame.stereo Fixes #23 --- fuzzing_test.go | 7 +++++++ internal/frame/frame.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fuzzing_test.go b/fuzzing_test.go index 410c3d0..b6cf7fc 100644 --- a/fuzzing_test.go +++ b/fuzzing_test.go @@ -83,6 +83,13 @@ func TestFuzzing(t *testing.T) { "00000000000000000000" + "00000000000000000000" + "00000000000000000000", + // #23 + "\xff\xfb%S000000v000\x00\x010000" + + "00000000000000000000" + + "0000\xf4000000000000000" + + "00000000000000000000" + + "00000000000000000000" + + "00000000000000000000", } for _, input := range inputs { b := &bytesReadCloser{bytes.NewReader([]byte(input))} diff --git a/internal/frame/frame.go b/internal/frame/frame.go index acbfcfc..cbd3337 100644 --- a/internal/frame/frame.go +++ b/internal/frame/frame.go @@ -327,7 +327,7 @@ func (f *Frame) stereoProcessIntensityShort(gr int, sfb int) { for win := 0; win < 3; win++ { // Check that((is_pos[sfb]=scalefac) != 7) => no intensity stereo is_pos := f.mainData.ScalefacS[gr][0][sfb][win] - if is_pos != 7 { + if is_pos < 7 { sfb_start := consts.SfBandIndicesSet[sfreq].S[sfb]*3 + win_len*win sfb_stop := sfb_start + win_len if is_pos == 6 { // tan((6*PI)/12 = PI/2) needs special treatment!