fix allocation of very large blocks by whisk · Pull Request #77 · mewkiz/flac

Hmm, at least locally the test cases fail after merging this PR:

--- FAIL: TestEncodeRoundTrip (9.94s)
    --- FAIL: TestEncodeRoundTrip/testdata/flac-test-files/subset/48_-_Extremely_large_SEEKTABLE.flac (0.00s)
        enc_test.go:153: "testdata/flac-test-files/subset/48 - Extremely large SEEKTABLE.flac": unable to parse FLAC file; meta.parseSeekTable: declared block size is too big to allocate, number of seekpoints: 932067
    --- FAIL: TestEncodeRoundTrip/testdata/flac-test-files/subset/54_-_1000x_repeating_VORBISCOMMENT.flac (0.00s)
        enc_test.go:153: "testdata/flac-test-files/subset/54 - 1000x repeating VORBISCOMMENT.flac": unable to parse FLAC file; meta.Block.parseVorbisComment: declared block size is too big to allocate, tags number=20000
    --- FAIL: TestEncodeRoundTrip/testdata/flac-test-files/subset/55_-_file_48-53_combined.flac (0.00s)
        enc_test.go:153: "testdata/flac-test-files/subset/55 - file 48-53 combined.flac": unable to parse FLAC file; meta.parseSeekTable: declared block size is too big to allocate, number of seekpoints: 932067
--- FAIL: TestEncodeAnalysisFixed (18.62s)
    --- FAIL: TestEncodeAnalysisFixed/testdata/flac-test-files/subset/48_-_Extremely_large_SEEKTABLE.flac (0.00s)
        enc_test.go:264: "testdata/flac-test-files/subset/48 - Extremely large SEEKTABLE.flac": unable to parse FLAC file; meta.parseSeekTable: declared block size is too big to allocate, number of seekpoints: 932067
    --- FAIL: TestEncodeAnalysisFixed/testdata/flac-test-files/subset/54_-_1000x_repeating_VORBISCOMMENT.flac (0.00s)
        enc_test.go:264: "testdata/flac-test-files/subset/54 - 1000x repeating VORBISCOMMENT.flac": unable to parse FLAC file; meta.Block.parseVorbisComment: declared block size is too big to allocate, tags number=20000
    --- FAIL: TestEncodeAnalysisFixed/testdata/flac-test-files/subset/55_-_file_48-53_combined.flac (0.00s)
        enc_test.go:264: "testdata/flac-test-files/subset/55 - file 48-53 combined.flac": unable to parse FLAC file; meta.parseSeekTable: declared block size is too big to allocate, number of seekpoints: 932067
--- FAIL: TestDecode (0.29s)
    --- FAIL: TestDecode/newSeek/testdata/flac-test-files/subset/48_-_Extremely_large_SEEKTABLE.flac (0.00s)
        flac_test.go:190: meta.parseSeekTable: declared block size is too big to allocate, number of seekpoints: 932067
    --- FAIL: TestDecode/parse/testdata/flac-test-files/subset/48_-_Extremely_large_SEEKTABLE.flac (0.00s)
        flac_test.go:190: meta.parseSeekTable: declared block size is too big to allocate, number of seekpoints: 932067
    --- FAIL: TestDecode/newSeek/testdata/flac-test-files/subset/54_-_1000x_repeating_VORBISCOMMENT.flac (0.00s)
        flac_test.go:190: meta.Block.parseVorbisComment: declared block size is too big to allocate, tags number=20000
    --- FAIL: TestDecode/parse/testdata/flac-test-files/subset/54_-_1000x_repeating_VORBISCOMMENT.flac (0.00s)
        flac_test.go:190: meta.Block.parseVorbisComment: declared block size is too big to allocate, tags number=20000
    --- FAIL: TestDecode/newSeek/testdata/flac-test-files/subset/55_-_file_48-53_combined.flac (0.00s)
        flac_test.go:190: meta.parseSeekTable: declared block size is too big to allocate, number of seekpoints: 932067
    --- FAIL: TestDecode/parse/testdata/flac-test-files/subset/55_-_file_48-53_combined.flac (0.00s)
        flac_test.go:190: meta.parseSeekTable: declared block size is too big to allocate, number of seekpoints: 932067
FAIL
FAIL	github.com/mewkiz/flac	28.885s
ok  	github.com/mewkiz/flac/frame	10.856s
ok  	github.com/mewkiz/flac/internal/bits	0.008s
ok  	github.com/mewkiz/flac/internal/bufseekio	0.002s
?   	github.com/mewkiz/flac/internal/hashutil	[no test files]
ok  	github.com/mewkiz/flac/internal/hashutil/crc16	0.002s
ok  	github.com/mewkiz/flac/internal/hashutil/crc8	0.002s
?   	github.com/mewkiz/flac/internal/ioutilx	[no test files]
?   	github.com/mewkiz/flac/internal/utf8	[no test files]
ok  	github.com/mewkiz/flac/meta	0.003s
FAIL

@whisk, do you have the chance to take a look? And perhaps adjust the thresholds if needed or make the error for these test cases a valid success?