Comcast / gaad

GAAD (Go Advanced Audio Decoder)
Apache License 2.0
126 stars 19 forks source link

panic: runtime error: index out of range in gaad.(*ADTS).excluded_channels #11

Closed gy741 closed 3 years ago

gy741 commented 6 years ago

Hello.

I found a index out of range bug in gaad.

Please confirm.

Thanks.

reproduce code:

package gaad

import (
    "testing"
)

func TestFuzzCrashers(t *testing.T) {

    var crashers = []string{
        "\xff\xf10\xdc0\xb8\xad",
    }

    for _, f := range crashers {
        ParseADTS([]byte(f))
    }
}

Crash Log:

--- FAIL: TestFuzzCrashers (0.00s)
panic: runtime error: index out of range [recovered]
    panic: runtime error: index out of range

goroutine 17 [running]:
testing.tRunner.func1(0xc42004d5f0)
    /usr/lib/go-1.8/src/testing/testing.go:622 +0x29d
panic(0x5337a0, 0x5fbe10)
    /usr/lib/go-1.8/src/runtime/panic.go:489 +0x2cf
github.com/Comcast/gaad.(*ADTS).excluded_channels(0xc42004d6c0, 0xc42009b301, 0x0)
    /home/karas/go/src/github.com/Comcast/gaad/aacparser.go:1832 +0x2ca
github.com/Comcast/gaad.(*ADTS).dynamic_range_info(0xc42004d6c0, 0x4, 0xb)
    /home/karas/go/src/github.com/Comcast/gaad/aacparser.go:1787 +0x3f7
github.com/Comcast/gaad.(*ADTS).extension_payload(0xc42004d6c0, 0x2, 0x4f0006, 0x0, 0x0, 0x0, 0x0)
    /home/karas/go/src/github.com/Comcast/gaad/aacparser.go:1731 +0x32b
github.com/Comcast/gaad.(*ADTS).fill_element(0xc42004d6c0, 0x6, 0x6, 0x0, 0x0)
    /home/karas/go/src/github.com/Comcast/gaad/aacparser.go:1293 +0xbf
github.com/Comcast/gaad.(*ADTS).raw_data_block(0xc42004d6c0, 0x0, 0x0)
    /home/karas/go/src/github.com/Comcast/gaad/aacparser.go:1020 +0x269
github.com/Comcast/gaad.(*ADTS).adts_frame(0xc42004d6c0, 0xc420019800, 0x7)
    /home/karas/go/src/github.com/Comcast/gaad/aacparser.go:796 +0x91
github.com/Comcast/gaad.ParseADTS(0xc4200b52a0, 0x7, 0x8, 0xc4200b52a0, 0x7, 0x8)
    /home/karas/go/src/github.com/Comcast/gaad/aacparser.go:773 +0xbe
github.com/Comcast/gaad.TestFuzzCrashers(0xc42004d5f0)
    /home/karas/go/src/github.com/Comcast/gaad/fuzzer_test.go:14 +0x90
testing.tRunner(0xc42004d5f0, 0x5647e0)
    /usr/lib/go-1.8/src/testing/testing.go:657 +0x96
created by testing.(*T).Run
    /usr/lib/go-1.8/src/testing/testing.go:697 +0x2ca
exit status 2
FAIL    github.com/Comcast/gaad 0.009s
BlakeOrth commented 6 years ago

Thanks for all these reports. We'll take a look at them when we get some time.