Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for ReadDataAt (0.15 sec)

  1. src/internal/saferio/io_test.go

    	input := bytes.Repeat([]byte{'a'}, count)
    
    	t.Run("small", func(t *testing.T) {
    		got, err := ReadDataAt(bytes.NewReader(input), count, 0)
    		if err != nil {
    			t.Fatal(err)
    		}
    		if !bytes.Equal(got, input) {
    			t.Errorf("got %v, want %v", got, input)
    		}
    	})
    
    	t.Run("large", func(t *testing.T) {
    		_, err := ReadDataAt(bytes.NewReader(input), 10<<30, 0)
    		if err == nil {
    			t.Error("large read succeeded unexpectedly")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 31 00:34:05 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  2. src/debug/buildinfo/buildinfo.go

    	for _, prog := range x.f.Progs {
    		if prog.Vaddr <= addr && addr <= prog.Vaddr+prog.Filesz-1 {
    			n := prog.Vaddr + prog.Filesz - addr
    			if n > size {
    				n = size
    			}
    			return saferio.ReadDataAt(prog, n, int64(addr-prog.Vaddr))
    		}
    	}
    	return nil, errUnrecognizedFormat
    }
    
    func (x *elfExe) DataStart() (uint64, uint64) {
    	for _, s := range x.f.Sections {
    		if s.Name == ".go.buildinfo" {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 12.6K bytes
    - Viewed (0)
  3. src/internal/saferio/io.go

    			return nil, err
    		}
    		buf = append(buf, buf1[:next]...)
    		n -= next
    	}
    	return buf, nil
    }
    
    // ReadDataAt reads n bytes from the input stream at off, but avoids
    // allocating all n bytes if n is large. This avoids crashing the program
    // by allocating all n bytes in cases where n is incorrect.
    func ReadDataAt(r io.ReaderAt, n uint64, off int64) ([]byte, error) {
    	if int64(n) < 0 || n != uint64(int(n)) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 31 00:34:05 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  4. src/debug/macho/file.go

    				return nil, err
    			}
    			strtab, err := saferio.ReadDataAt(r, uint64(hdr.Strsize), int64(hdr.Stroff))
    			if err != nil {
    				return nil, err
    			}
    			var symsz int
    			if f.Magic == Magic64 {
    				symsz = 16
    			} else {
    				symsz = 12
    			}
    			symdat, err := saferio.ReadDataAt(r, uint64(hdr.Nsyms)*uint64(symsz), int64(hdr.Symoff))
    			if err != nil {
    				return nil, err
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 18 19:33:30 UTC 2023
    - 17.9K bytes
    - Viewed (0)
  5. src/debug/pe/section.go

    // Data reads and returns the contents of the PE section s.
    //
    // If s.Offset is 0, the section has no contents,
    // and Data will always return a non-nil error.
    func (s *Section) Data() ([]byte, error) {
    	return saferio.ReadDataAt(s.sr, uint64(s.Size), 0)
    }
    
    // Open returns a new ReadSeeker reading the PE section s.
    //
    // If s.Offset is 0, the section has no contents, and all calls
    // to the returned reader will return a non-nil error.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 18 19:33:30 UTC 2023
    - 3.5K bytes
    - Viewed (0)
  6. src/debug/plan9obj/file.go

    	// with other clients.
    	io.ReaderAt
    	sr *io.SectionReader
    }
    
    // Data reads and returns the contents of the Plan 9 a.out section.
    func (s *Section) Data() ([]byte, error) {
    	return saferio.ReadDataAt(s.sr, uint64(s.Size), 0)
    }
    
    // Open returns a new ReadSeeker reading the Plan 9 a.out section.
    func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 18 19:33:30 UTC 2023
    - 7.2K bytes
    - Viewed (0)
  7. src/internal/xcoff/file.go

    		return nil, err
    	}
    	// The first 4 bytes contain the length (in bytes).
    	var l uint32
    	if err := binary.Read(sr, binary.BigEndian, &l); err != nil {
    		return nil, err
    	}
    	if l > 4 {
    		st, err := saferio.ReadDataAt(sr, uint64(l), int64(offset))
    		if err != nil {
    			return nil, err
    		}
    		f.StringTable = st
    	}
    
    	// Read section headers
    	if _, err := sr.Seek(int64(hdrsz)+int64(opthdr), io.SeekStart); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 12 14:42:29 UTC 2024
    - 17.3K bytes
    - Viewed (0)
  8. src/debug/elf/file.go

    	}
    	if phnum > 0 && phentsize < wantPhentsize {
    		return nil, &FormatError{0, "invalid ELF phentsize", phentsize}
    	}
    
    	// Read program headers
    	f.Progs = make([]*Prog, phnum)
    	phdata, err := saferio.ReadDataAt(sr, uint64(phnum)*uint64(phentsize), phoff)
    	if err != nil {
    		return nil, err
    	}
    	for i := 0; i < phnum; i++ {
    		off := uintptr(i) * uintptr(phentsize)
    		p := new(Prog)
    		switch f.Class {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 23 16:49:58 UTC 2024
    - 43.1K bytes
    - Viewed (0)
Back to top