Uncaught Exception in Elf_Reader Library
esraercann opened this issue · 1 comments
esraercann commented
We discovered a crash in Elf_Reader library because of 'Uncaught Exception' via specially crafted input.
Here is the crash log:
goroutine 1 [running]:
github.com/yalue/elf_reader.(*ELF32File).GetSectionContent(0x0?, 0x0?)
/home/ubuntu/go/pkg/mod/github.com/yalue/elf_reader@v1.0.0/elf32_format.go:467 +0x289
github.com/yalue/elf_reader.(*ELF32File).GetSectionName(0xc00019a000, 0x1)
/home/ubuntu/go/pkg/mod/github.com/yalue/elf_reader@v1.0.0/elf32_format.go:508 +0x7f
fuzz_test.Fuzz({0x7fd9b0f45000?, 0x11?, 0xc0000c2730?})
/home/ubuntu/targets/math/main.go:21 +0x210
go-fuzz-dep.Main({0xc0000f4f68, 0x1, 0x4a76e0?})
go-fuzz-dep/main.go:36 +0x15a
main.main()
fuzz_test/go.fuzz.main/main.go:15 +0x3b
exit status 2
Harness File:
package fuzz_test
import (
"fmt"
"github.com/yalue/elf_reader"
)
func Fuzz(data []byte) int {
elf_reader.ParseELFFile()
elf, e := elf_reader.ParseELFFile(data)
if e != nil {
fmt.Printf("Failed parsing ELF file: %s\n", e)
return 0
}
count := elf.GetSectionCount()
for i := uint16(0); i < count; i++ {
if i == 0 {
fmt.Printf("Section 0: NULL section (no name)\n")
continue
}
name, e := elf.GetSectionName(uint16(i))
if e != nil {
fmt.Printf("Failed getting section %d name: %s\n", i, e)
continue
}
fmt.Printf("Section %d name: %s\n", i, name)
}
return 0
}