question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception: Read gave wrong length

See original GitHub issue

Description

This could be a viv bug.

Exception: Read gave wrong length at va: 0x140000ffc (wanted 8 got 4)

Steps to Reproduce

  1. python2 scripts/show-features.py -F 0x140001020 40c0a313897b26e14e54683ceace4a161859f368b0114a2ca614deca3b2ca5da The following error is produced
  File "scripts/show-features.py", line 190, in <module>
    sys.exit(main())
  File "scripts/show-features.py", line 107, in main
    vw = capa.main.get_workspace(args.sample, args.format)
  File "/usr/lib/python2.7/site-packages/flare_capa-1.4.0-py2.7.egg/capa/main.py", line 267, in get_workspace
    vw = viv_utils.getWorkspace(path, should_save=should_save)
  File "/usr/lib/python2.7/site-packages/viv_utils-0.3.17-py2.7.egg/viv_utils/__init__.py", line 86, in getWorkspace
    vw.loadFromFile(fp)
  File "/usr/lib/python2.7/site-packages/vivisect-0.1.0-py2.7.egg/vivisect/__init__.py", line 2480, in loadFromFile
    fname = mod.parseFile(self, filename, baseaddr=baseaddr)
  File "/usr/lib/python2.7/site-packages/vivisect-0.1.0-py2.7.egg/vivisect/parsers/pe.py", line 36, in parseFile
    return loadPeIntoWorkspace(vw, pe, filename, baseaddr=baseaddr)
  File "/usr/lib/python2.7/site-packages/vivisect-0.1.0-py2.7.egg/vivisect/parsers/pe.py", line 333, in loadPeIntoWorkspace
    mapoffset = vw.readMemoryPtr(rva + baseaddr) - baseaddr
  File "/usr/lib/python2.7/site-packages/vivisect-0.1.0-py2.7.egg/envi/memory.py", line 189, in readMemoryPtr
    return self.readMemValue(va, self.imem_psize)
  File "/usr/lib/python2.7/site-packages/vivisect-0.1.0-py2.7.egg/envi/memory.py", line 178, in readMemValue
    raise Exception("Read gave wrong length at va: 0x%.8x (wanted %d got %d)" % (addr, size, len(bytes)))
Exception: Read gave wrong length at va: 0x140000ffc (wanted 8 got 4)

Expected behavior: Executable to be processed

Actual behavior: Exception is raised

Versions

Master from git

Additional Information

Sample is attached here (password infected) mal.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
williballenthincommented, Jan 28, 2021

triaged upstream. awaiting review and merge (or reject) of https://github.com/vivisect/vivisect/pull/347

if its rejected, then this is a situation of unsuccessfully trying to process a corrupt PE file. carrying on or rejecting such a binary are both valid strategies, imho.

2reactions
upside2commented, Jan 26, 2021

This sample executes without error in our production environment, which has #338.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java Beginner: What to use with wrong length vector passed ...
Here's the rule of thumb I use. If it's something you EXPECT and RECOVER FROM, use a CHECKED exception. If it's something that...
Read more >
Error handling in Step Functions - AWS Documentation
Step Functions reports a States.DataLimitExceeded exception under the following conditions: When the output of a connector is larger than payload size quota ......
Read more >
7 Handling PL/SQL Errors
In PL/SQL, a warning or error condition is called an exception. Exceptions can be internally defined (by the run-time system) or user defined....
Read more >
Service Bus messaging exceptions - Azure - Microsoft Learn
This article provides a list of Azure Service Bus messaging exceptions and suggested actions to taken when the exception occurs.
Read more >
7 Common Mistakes You Should Avoid When Handling Java ...
Mistake 3: Log and throw an Exception · You don't have enough information about the use case the caller of your method wants...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found