Skip to content
This repository was archived by the owner on Apr 2, 2023. It is now read-only.

Commit 3c185f9

Browse files
committed
frames: Bug fix: crash at *Frame.stereoProcessIntensityLong
Fixes #24
1 parent 81bb838 commit 3c185f9

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

fuzzing_test.go

+17
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,23 @@ func TestFuzzing(t *testing.T) {
9090
"00000000000000000000" +
9191
"00000000000000000000" +
9292
"00000000000000000000",
93+
// #24
94+
"\xff\xfb0x000000\xf9000\x00\x030000" +
95+
"000000000000\xf70000000" +
96+
"\x900000000000000000000" +
97+
"00000000000000000000" +
98+
"00000000000000000000" +
99+
"00000000000000000000" +
100+
"00000000000000000000" +
101+
"00000000000000000000" +
102+
"00000000000000000000" +
103+
"00000000000000000000" +
104+
"00000000000000000000" +
105+
"00000000000000000000" +
106+
"00000000000000000000" +
107+
"00000000000000000000" +
108+
"00000000000000000000" +
109+
"0000000000000",
93110
}
94111
for _, input := range inputs {
95112
b := &bytesReadCloser{bytes.NewReader([]byte(input))}

internal/frame/frame.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ var (
297297
func (f *Frame) stereoProcessIntensityLong(gr int, sfb int) {
298298
is_ratio_l := float32(0)
299299
is_ratio_r := float32(0)
300-
// Check that((is_pos[sfb]=scalefac) != 7) => no intensity stereo
301-
if is_pos := f.mainData.ScalefacL[gr][0][sfb]; is_pos != 7 {
300+
// Check that((is_pos[sfb]=scalefac) < 7) => no intensity stereo
301+
if is_pos := f.mainData.ScalefacL[gr][0][sfb]; is_pos < 7 {
302302
sfreq := f.header.SamplingFrequency() // Setup sampling freq index
303303
sfb_start := consts.SfBandIndicesSet[sfreq].L[sfb]
304304
sfb_stop := consts.SfBandIndicesSet[sfreq].L[sfb+1]
@@ -325,7 +325,7 @@ func (f *Frame) stereoProcessIntensityShort(gr int, sfb int) {
325325
win_len := consts.SfBandIndicesSet[sfreq].S[sfb+1] - consts.SfBandIndicesSet[sfreq].S[sfb]
326326
// The three windows within the band has different scalefactors
327327
for win := 0; win < 3; win++ {
328-
// Check that((is_pos[sfb]=scalefac) != 7) => no intensity stereo
328+
// Check that((is_pos[sfb]=scalefac) < 7) => no intensity stereo
329329
is_pos := f.mainData.ScalefacS[gr][0][sfb][win]
330330
if is_pos < 7 {
331331
sfb_start := consts.SfBandIndicesSet[sfreq].S[sfb]*3 + win_len*win

0 commit comments

Comments
 (0)