No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.
For #47653
Fixes #52526
Change-Id: Id90a5e391a4f684f45f8d7e32608eb03b8081076
Reviewed-on: https://go-review.googlesource.com/c/go/+/413875
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
"debug/dwarf"
"encoding/binary"
"fmt"
+ "internal/saferio"
"io"
"os"
"strings"
return nil, err
}
if l > 4 {
- if _, err := sr.Seek(int64(offset), io.SeekStart); err != nil {
- return nil, err
- }
- f.StringTable = make([]byte, l)
- if _, err := io.ReadFull(sr, f.StringTable); err != nil {
+ st, err := saferio.ReadDataAt(sr, uint64(l), int64(offset))
+ if err != nil {
return nil, err
}
+ f.StringTable = st
}
// Read section headers