File tree 1 file changed +5
-9
lines changed
1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ package xcoff
8
8
import (
9
9
"debug/dwarf"
10
10
"encoding/binary"
11
+ "errors"
11
12
"fmt"
12
13
"internal/saferio"
13
14
"io"
@@ -261,7 +262,7 @@ func NewFile(r io.ReaderAt) (*File, error) {
261
262
}
262
263
r2 := r
263
264
if scnptr == 0 { // .bss must have all 0s
264
- r2 = zeroReaderAt {}
265
+ r2 = & nobitsSectionReader {}
265
266
}
266
267
s .sr = io .NewSectionReader (r2 , int64 (scnptr ), int64 (s .Size ))
267
268
s .ReaderAt = s .sr
@@ -451,15 +452,10 @@ func NewFile(r io.ReaderAt) (*File, error) {
451
452
return f , nil
452
453
}
453
454
454
- // zeroReaderAt is ReaderAt that reads 0s.
455
- type zeroReaderAt struct {}
455
+ type nobitsSectionReader struct {}
456
456
457
- // ReadAt writes len(p) 0s into p.
458
- func (w zeroReaderAt ) ReadAt (p []byte , off int64 ) (n int , err error ) {
459
- for i := range p {
460
- p [i ] = 0
461
- }
462
- return len (p ), nil
457
+ func (* nobitsSectionReader ) ReadAt (p []byte , off int64 ) (n int , err error ) {
458
+ return 0 , errors .New ("unexpected read from section with uninitialized data" )
463
459
}
464
460
465
461
// Data reads and returns the contents of the XCOFF section s.
You can’t perform that action at this time.
0 commit comments