OverflowError: Python int too large to convert to C long
OS / Environment
Ubuntu 16.04
Python version
Python 2.7.12
Dependencies
adium-theme-ubuntu==0.3.4 alabaster==0.7.10 attrs==15.2.0 Babel==2.4.0 beautifulsoup4==4.4.1 blinker==1.3 capstone==3.0.5rc2 certifi==2017.4.17 chardet==3.0.3 coverage==4.4.1 cryptography==1.2.3 debtags==2.0 defer==1.0.6 dirspec==13.10 docutils==0.13.1 duplicity==0.7.6 enum34==1.1.2 html5lib==0.999 httplib2==0.9.1 idna==2.5 imagesize==0.7.1 ipaddress==1.0.16 Jinja2==2.9.6 keystone-engine==0.9.1.post3 lockfile==0.12.2 lxml==3.5.0 -e git+https://github.com/trailofbits/manticore.git@5b5392e54dd3a653adfdae8c09198ceaf73042cf#egg=manticore MarkupSafe==1.0 ndg-httpsclient==0.4.0 nose==1.3.7 oauthlib==1.0.3 oneconf==0.3.9 PAM==0.4.2 Pillow==3.1.2 piston-mini-client==0.7.5 ply==3.10 pyasn1==0.1.9 pyasn1-modules==0.0.7 pycrypto==2.6.1 pycups==1.9.73 pyelftools==0.24 Pygments==2.2.0 pygobject==3.20.0 PyJWT==1.3.0 pyOpenSSL==0.15.1 pyserial==3.0.1 python-apt==1.1.0b1 python-debian==0.1.27 pytz==2017.2 pyxdg==0.25 requests==2.17.3 service-identity==16.0.0 six==1.10.0 snowballstemmer==1.2.1 software-center-aptd-plugins==0.0.0 Sphinx==1.6.2 sphinxcontrib-websupport==1.0.1 Twisted==16.0.0 typing==3.6.1 ubuntuone-client-data==14.4 unicorn==1.0.1 unity-lens-photos==1.0 urllib3==1.21.1 zope.interface==4.1.3
Summary of the problem
When I use manticore to analyze a binary (x86), I meet an overflow error. As shown in the details, the reason is "Python int too large to convert to C long". I don't know how to solve this issue.
Step to reproduce the behavior
manticore
Expected behavior
Actual behavior
2017-05-31 21:21:56,797: [2724][0] EXECUTOR:ERROR: File "/home/chicken/manticore/manticore/core/memory.py", line 349, in getitem 2017-05-31 21:21:56,797: [2724][0] EXECUTOR:ERROR: for i in xrange(index.start, index.stop): 2017-05-31 21:21:56,802: [2724][0] EXECUTOR:ERROR: OverflowError: Python int too large to convert to C long
Any relevant logs
@yuedeji can you share the binary?
Sure. The binary is attached. Thanks for your help. dfg_test.zip
This happens on a 32-bit ubuntu 16.04, while I switch to 64-bit, it works well. I have not figured out the specific reasons, but it can work now.
I have the same problem, when I tried to run manticore on my x86 system (Linux Master 3.19.0-25-generic # 26~14.04.1-Ubuntu SMP Fri Jul 24 21:18:00 UTC 2015 i686 i686 i686 GNU/Linux). My target is a x86 program. How could I fix it up?
With #897 applied from commit 058943763b6aa44ee834538b60593667cf4f1070, I was unable to reproduce this bug
manticore -v dfg_test --env LD_LIBRARY_PATH=/usr/local/lib/linux/
outputs
2018-06-01 09:42:41,880: [34791] m.manticore:INFO: Loading program dfg_test
2018-06-01 09:42:41,887: [34791] m.p.linux:DEBUG: Opening file descriptors (0,1,2) (STDIN, STDOUT, STDERR)
2018-06-01 09:42:41,887: [34791] m.p.linux:DEBUG: Loading dfg_test as a i386 elf
2018-06-01 09:42:41,887: [34791] m.p.linux:DEBUG: Loading dfg_test as a i386 elf
2018-06-01 09:42:41,887: [34791] m.p.linux:INFO: Interpreter filename: /lib/ld-linux.so.2
2018-06-01 09:42:41,888: [34791] m.p.linux:INFO: looking for interpreter /usr/local/lib/linux/ld-linux.so.2
2018-06-01 09:42:41,894: [34791] m.p.linux:DEBUG: Loading elf offset: 00000000 addr:08048000 08049000 r x
2018-06-01 09:42:41,894: [34791] m.p.linux:DEBUG: Loading elf offset: 00000000 addr:08049000 0804b000 rw
2018-06-01 09:42:41,896: [34791] m.p.linux:DEBUG: Zeroing main elf fractional pages. From bss(804a020) to brk(804b000), 4064 bytes.
2018-06-01 09:42:42,051: [34791] m.p.linux:DEBUG: Loading interpreter offset: 00000000 addr:bffc4000 bffdd000 r x
2018-06-01 09:42:42,051: [34791] m.p.linux:DEBUG: Loading interpreter offset: 00019000 addr:bffdd000 bffdf000 wx
2018-06-01 09:42:42,053: [34791] m.p.linux:DEBUG: Zeroing interpreter elf fractional pages. From bss(bffde628) to brk(bffdf000), 2520 bytes.
2018-06-01 09:42:43,351: [34791] m.p.linux:DEBUG: Entry point: 00000000bffc4810
2018-06-01 09:42:43,351: [34791] m.p.linux:DEBUG: Stack start: 00000000c0000000
2018-06-01 09:42:43,352: [34791] m.p.linux:DEBUG: Brk: 000000000804b000
2018-06-01 09:42:43,352: [34791] m.p.linux:DEBUG: Mappings:
2018-06-01 09:42:43,352: [34791] m.p.linux:DEBUG: 0000000008048000-0000000008049000 r x 00000000 dfg_test
2018-06-01 09:42:43,352: [34791] m.p.linux:DEBUG: 0000000008049000-000000000804b000 rw 00000000 dfg_test
2018-06-01 09:42:43,352: [34791] m.p.linux:DEBUG: 00000000bffc4000-00000000bffdd000 r x 00000000 /usr/local/lib/linux/ld-linux.so.2
2018-06-01 09:42:43,352: [34791] m.p.linux:DEBUG: 00000000bffdd000-00000000bffdf000 rw 00019000 /usr/local/lib/linux/ld-linux.so.2
2018-06-01 09:42:43,352: [34791] m.p.linux:DEBUG: 00000000bffdf000-00000000c0000000 rwx 00000000
2018-06-01 09:42:43,354: [34791] m.p.linux:DEBUG: Setting argv, envp and auxv.
2018-06-01 09:42:43,354: [34791] m.p.linux:DEBUG: Arguments: ['dfg_test']
2018-06-01 09:42:43,354: [34791] m.p.linux:DEBUG: Environment:
2018-06-01 09:42:43,354: [34791] m.p.linux:DEBUG: 'LD_LIBRARY_PATH=/usr/local/lib/linux/'
2018-06-01 09:42:43,354: [34791] m.p.linux:DEBUG: Auxv:
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_PAGESZ: 0x1000
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_PHDR: 0x8048034
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_UID: 0x3e8
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_FLAGS: 0x0
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_EXECFN: 0xbfffffcf
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_CLKTCK: 0x64
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_PHENT: 0x20
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_ENTRY: 0x8048320
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_RANDOM: 0xbffffff0
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_EGID: 0x3e8
2018-06-01 09:42:43,355: [34791] m.p.linux:DEBUG: AT_PHNUM: 0x9
2018-06-01 09:42:43,356: [34791] m.p.linux:DEBUG: AT_GID: 0x3e8
2018-06-01 09:42:43,356: [34791] m.p.linux:DEBUG: AT_BASE: 0xbffc4000
2018-06-01 09:42:43,356: [34791] m.p.linux:DEBUG: AT_HWCAP: 0x0
2018-06-01 09:42:43,356: [34791] m.p.linux:DEBUG: AT_EUID: 0x3e8
2018-06-01 09:42:43,495: [34791] m.c.executor:INFO: load state 0
2018-06-01 09:42:44,400: [34791] m.p.platform:DEBUG: sys_brk(0x0) -> 134524928(0x804b000)
2018-06-01 09:42:45,877: [34791] m.p.platform:DEBUG: sys_newuname(0xbffffc52 (Linux)) -> 0
2018-06-01 09:42:46,072: [34791] m.p.platform:DEBUG: sys_access(0xbffdbeab (/etc/ld.so.nohwcap), 0x0) -> -1
2018-06-01 09:42:46,444: [34791] m.p.platform:DEBUG: sys_mmap_pgoff(0x0, 0x1000, 0x3, 0x22, 0xffffffff, 0x0) -> 4160745472(0xf7fff000)
2018-06-01 09:42:48,244: [34791] m.p.platform:DEBUG: sys_access(0xbffdbb5b (/etc/ld.so.preload), 0x4) -> -1
2018-06-01 09:42:49,519: [34791] m.p.linux:INFO: Could not open file /usr/local/lib/linux/tls/libc.so.6. Reason: [Errno 2] No such file or directory: '/usr/local/lib/linux/tls/libc.so.6'
2018-06-01 09:42:49,522: [34791] m.p.platform:DEBUG: sys_open(0xbffff5c0 (/usr/local/lib/linux/tls/libc.so..), 0x0, 0x0) -> -2
2018-06-01 09:42:49,609: [34791] m.p.linux:INFO: Could not open file /usr/local/lib/linux/tls. Reason: [Errno 2] No such file or directory: '/usr/local/lib/linux/tls'
2018-06-01 09:42:49,609: [34791] m.p.linux:INFO: Calling fstat with invalid fd, returning EBADF
2018-06-01 09:42:49,611: [34791] m.p.platform:DEBUG: sys_stat64(0xbffff5c0 (/usr/local/lib/linux/tls), 0xbffff61c) -> -9
2018-06-01 09:42:49,746: [34791] m.p.linux:DEBUG: Opening file /usr/local/lib/linux/libc.so.6 for real fd 3
2018-06-01 09:42:49,749: [34791] m.p.platform:DEBUG: sys_open(0xbffff5c0 (/usr/local/lib/linux/libc.so.6), 0x0, 0x0) -> 3
2018-06-01 09:42:49,807: [34791] m.p.platform:DEBUG: sys_read(0x3, 0xbffff700, 0x200) -> 512(0x200)
2018-06-01 09:42:50,276: [34791] m.p.platform:DEBUG: sys_fstat64(0x3, 0xbffff60c) -> 0
2018-06-01 09:42:51,297: [34791] m.p.platform:DEBUG: sys_mmap_pgoff(0x0, 0x12b5a4, 0x5, 0x802, 0x3, 0x0) -> 4159516672(0xf7ed3000)
2018-06-01 09:42:51,398: [34791] m.p.platform:DEBUG: sys_mmap_pgoff(0xf7ff9000, 0x3000, 0x3, 0x812, 0x3, 0x125) -> 4160720896(0xf7ff9000)
2018-06-01 09:42:51,907: [34791] m.p.platform:DEBUG: sys_mmap_pgoff(0xf7ffc000, 0x25a4, 0x3, 0x32, 0xffffffff, 0x0) -> 4160733184(0xf7ffc000)
2018-06-01 09:42:52,291: [34791] m.p.linux:DEBUG: sys_close(3)
2018-06-01 09:42:52,291: [34791] m.p.platform:DEBUG: sys_close(0x3) -> 0
2018-06-01 09:42:57,270: [34791] m.p.platform:DEBUG: sys_mmap_pgoff(0x0, 0x1000, 0x3, 0x22, 0xffffffff, 0x0) -> 4159512576(0xf7ed2000)
2018-06-01 09:42:58,185: [34791] m.p.platform:DEBUG: sys_set_thread_area(0xbffffafc) -> 0
2018-06-01 09:43:58,255: [34791] m.p.platform:DEBUG: sys_mprotect(0xf7ff9000, 0x1000, 0x1) -> 0
2018-06-01 09:43:59,065: [34791] m.p.platform:DEBUG: sys_mprotect(0x8049000, 0x1000, 0x1) -> 0
2018-06-01 09:44:06,616: [34791] m.p.platform:DEBUG: sys_fstat64(0x1, 0xbffff748) -> 0
2018-06-01 09:44:06,679: [34791] m.p.platform:DEBUG: sys_mmap_pgoff(0x0, 0x2000, 0x3, 0x22, 0xffffffff, 0x0) -> 4159504384(0xf7ed0000)
2018-06-01 09:44:07,259: [34791] m.manticore:INFO: Generated testcase No. 0 - Invalid memory access (mode:r) <1c>
2018-06-01 09:44:07,267: [34791] m.c.plugin:INFO: Instructions executed: 97241
2018-06-01 09:44:07,267: [34791] m.manticore:INFO: Results in mcore_qDObwT
2018-06-01 09:44:07,267: [34791] m.manticore:INFO: Total time: 83.8024420738
2018-06-01 09:44:07,275: [34791] m.c.plugin:INFO: Coverage: 6439 different instructions executed
@catenacyber Thx for checking this out. Closing as it seems fixed.