Skip to content

Panic (index out of range) inside the library when attempting to unmarshal large file. #194

Closed
@marcopaganini

Description

@marcopaganini

I'm attempting to Unmarshal a data buffer with the contents of a large file (Download), but I get an error inside the json-iterator code:

panic: runtime error: index out of range

goroutine 1 [running]:
github.com/json-iterator/go.growOne(0xc420094300, 0x5fb680, 0x5134c0, 0x5fb680, 0x535180)
        /home/paganini/go/src/github.com/json-iterator/go/feature_reflect_slice.go:134 +0x17a
github.com/json-iterator/go.(*sliceDecoder).doDecode.func1(0xc420610000, 0x51342c)
        /home/paganini/go/src/github.com/json-iterator/go/feature_reflect_slice.go:100 +0x68
github.com/json-iterator/go.(*Iterator).ReadArrayCB(0xc420610000, 0xc42004f738, 0x5134c0)
        /home/paganini/go/src/github.com/json-iterator/go/feature_iter_array.go:39 +0xc3
github.com/json-iterator/go.(*sliceDecoder).doDecode(0xc4200948d0, 0xc420094300, 0xc420610000)
        /home/paganini/go/src/github.com/json-iterator/go/feature_reflect_slice.go:99 +0xfc
github.com/json-iterator/go.(*sliceDecoder).Decode(0xc4200948d0, 0xc420094300, 0xc420610000)
        /home/paganini/go/src/github.com/json-iterator/go/feature_reflect_slice.go:82 +0x4c
github.com/json-iterator/go.(*structFieldDecoder).Decode(0xc420098800, 0xc420094300, 0xc420610000)
        /home/paganini/go/src/github.com/json-iterator/go/feature_reflect_struct_decoder.go:930 +0x5c
github.com/json-iterator/go.(*twoFieldsStructDecoder).Decode(0xc420094ea0, 0xc420094300, 0xc420610000)
        /home/paganini/go/src/github.com/json-iterator/go/feature_reflect_struct_decoder.go:524 +0x264
github.com/json-iterator/go.(*Iterator).ReadVal(0xc420610000, 0x50e480, 0xc420094300)
        /home/paganini/go/src/github.com/json-iterator/go/feature_reflect.go:236 +0xd1
github.com/json-iterator/go.(*frozenConfig).Unmarshal(0xc4200a8400, 0xc520266000, 0x9985053d, 0xfffffe00, 0x50e480, 0xc420094300, 0x0, 0x0)
        /home/paganini/go/src/github.com/json-iterator/go/feature_config.go:319 +0x1ab
main.main()
        /home/paganini/go/src/github.com/marcopaganini/op-desafios/desafio-05/marcopaganini/d05.go:100 +0x1fc

This particular file is parsed by the standard encoding/json library without any problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions