Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OverflowError ... #1

Closed
urgrueA opened this issue Aug 16, 2016 · 3 comments
Closed

OverflowError ... #1

urgrueA opened this issue Aug 16, 2016 · 3 comments
Assignees

Comments

@urgrueA
Copy link

urgrueA commented Aug 16, 2016

Trying to recover files after CHKDSK screwed up my filesystem on boot. I have a 1.82TB partition image and have a save file of size 2017KB. Is my image too big for RecuperaBit?

Here is the offending output:

...
...
INFO:root:Found NTFS boot sector at sector 3906854911
INFO:root:First scan completed
INFO:root:Saving results to h:\savefile.txt
INFO:root:Parsing MFT entries
INFO:root:Parsing INDX records
INFO:root:Reading boot sectors
DEBUG:root:Dropping bogus NTFS partition with MFT position 1953427448 generated
by MFT mirror of partition at offset 0
INFO:root:Finding partition geometry
Traceback (most recent call last):
  File "main.py", line 309, in <module>
    main()
  File "main.py", line 286, in main
    parts.update(scanner.get_partitions())
  File "D:\Program Files (x86)\RecuperaBit\recuperabit\fs\ntfs.py", line 821, in
 get_partitions
    part, address, most_likely
  File "D:\Program Files (x86)\RecuperaBit\recuperabit\fs\ntfs.py", line 527, in
 find_boundary
    width = len(text_list)
OverflowError: long int too large to convert to int

Thanks

@Lazza
Copy link
Owner

Lazza commented Aug 17, 2016

width = len(text_list)

Unfortunately, len in Python returns an int. See for example what is written here:

There seems to have been a debate on the Python list about having len() silently "lie" and clip lengths at sys.maxint, with the result of keeping the status-quo of raising an OverflowError.

This is limited to either 32 bits or 64 bits, depending on the architecture. Are you running Python 32-bit or 64-bit?

I could "fix" it by doing the same clipping at sys.maxint but this could make the search for the partition boundaries less effective so I do not think it's a very good idea. But if you are using Python 32-bit, the first thing to do is trying with Python 64-bit.

@Lazza
Copy link
Owner

Lazza commented Aug 17, 2016

BTW Please also note that said limitation is implementation-dependent:

In #12159, Victor correctly labelled this an implementation (IE, CPython) detail (limitation). I don't believe any implementation has to limit the range of len(). So the question is whether we should add a CPython implementation limit note, including the possibility of OverflowError, and if so, to both len() and __len__() entries.

In other words, PyPy might not show the same limitations as the standard CPython interpreter. Could you test with PyPy as well?

@Lazza Lazza closed this as completed in 90e566b Aug 28, 2016
@Lazza Lazza self-assigned this Aug 28, 2016
@Lazza
Copy link
Owner

Lazza commented Aug 28, 2016

@urgrueA it turns out I can bypass the Python limitation because the __len__() method that was crashing len() does not have problems if it's called alone, it just performs a simple addition. You should be able to run RecuperaBit on your drive now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants