pypoker-eval causes python to core dump

Bug #508739 reported by mathrawka
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
poker-eval (Ubuntu)
Fix Released
Undecided
Loic Dachary

Bug Description

Calling poker_eval() for game='omaha' with 3 Omaha hands and a board of 3 known cards causes python to core dump. Doing only 2 Omaha hands does not have this problem.

In [3]: pe.poker_eval(game='omaha', pockets=[['2s', '8d', 'Js', '6c'], ['Ad', 'Qh', '3h', 'Ts'], ['8h', '4c', 'Ac', '7h']], board=["9d", "tc", "6h", "__", "__"] )
*** glibc detected *** /usr/bin/python: free(): invalid next size (fast): 0x00000000029e3e40 ***
======= Backtrace: =========
/lib/libc.so.6[0x7fbce1711dd6]
/lib/libc.so.6(cfree+0x6c)[0x7fbce171674c]
/usr/lib/python2.6/dist-packages/_pokereval_2_6.so[0x7fbcdf492c26]
/usr/bin/python(PyEval_EvalFrameEx+0x4c89)[0x4a2299]
/usr/bin/python(PyEval_EvalCodeEx+0x860)[0x4a40e0]
/usr/bin/python(PyEval_EvalFrameEx+0x4e4f)[0x4a245f]
/usr/bin/python(PyEval_EvalCodeEx+0x860)[0x4a40e0]
/usr/bin/python(PyEval_EvalCode+0x32)[0x4a41b2]
/usr/bin/python(PyEval_EvalFrameEx+0x61c0)[0x4a37d0]
/usr/bin/python(PyEval_EvalCodeEx+0x860)[0x4a40e0]
/usr/bin/python(PyEval_EvalFrameEx+0x4e4f)[0x4a245f]
/usr/bin/python(PyEval_EvalCodeEx+0x860)[0x4a40e0]
/usr/bin/python(PyEval_EvalFrameEx+0x4e4f)[0x4a245f]
/usr/bin/python(PyEval_EvalFrameEx+0x5837)[0x4a2e47]
/usr/bin/python(PyEval_EvalCodeEx+0x860)[0x4a40e0]
/usr/bin/python(PyEval_EvalFrameEx+0x4e4f)[0x4a245f]
/usr/bin/python(PyEval_EvalCodeEx+0x860)[0x4a40e0]
/usr/bin/python(PyEval_EvalFrameEx+0x4e4f)[0x4a245f]
/usr/bin/python(PyEval_EvalCodeEx+0x860)[0x4a40e0]
/usr/bin/python(PyEval_EvalFrameEx+0x4e4f)[0x4a245f]
/usr/bin/python(PyEval_EvalCodeEx+0x860)[0x4a40e0]
/usr/bin/python(PyEval_EvalCode+0x32)[0x4a41b2]
/usr/bin/python(PyRun_FileExFlags+0xb0)[0x4c33a0]
/usr/bin/python(PyRun_SimpleFileExFlags+0xd4)[0x4c3564]
/usr/bin/python(Py_Main+0x9f7)[0x418ab7]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7fbce16baabd]
/usr/bin/python[0x417ca9]
======= Memory map: ========
00400000-0060f000 r-xp 00000000 08:01 44744705 /usr/bin/python2.6
0080e000-0080f000 r--p 0020e000 08:01 44744705 /usr/bin/python2.6
0080f000-00870000 rw-p 0020f000 08:01 44744705 /usr/bin/python2.6
00870000-0087e000 rw-p 00000000 00:00 0
02488000-02a8b000 rw-p 00000000 00:00 0 [heap]
7fbcd8000000-7fbcd8021000 rw-p 00000000 00:00 0
7fbcd8021000-7fbcdc000000 ---p 00000000 00:00 0
7fbcdeb4e000-7fbcdeb64000 r-xp 00000000 08:01 3342350 /lib/libgcc_s.so.1
7fbcdeb64000-7fbcded63000 ---p 00016000 08:01 3342350 /lib/libgcc_s.so.1
7fbcded63000-7fbcded64000 r--p 00015000 08:01 3342350 /lib/libgcc_s.so.1
7fbcded64000-7fbcded65000 rw-p 00016000 08:01 3342350 /lib/libgcc_s.so.1
7fbcded65000-7fbcded85000 r-xp 00000000 08:01 24609023 /usr/lib/libpoker-eval.so.1.0.0
7fbcded85000-7fbcdef85000 ---p 00020000 08:01 24609023 /usr/lib/libpoker-eval.so.1.0.0
7fbcdef85000-7fbcdefe2000 rw-p 00020000 08:01 24609023 /usr/lib/libpoker-eval.so.1.0.0
7fbcdefe2000-7fbcdf215000 r-xp 00000000 08:01 44769413 /usr/lib/libpython2.6.so.1.0
7fbcdf215000-7fbcdf414000 ---p 00233000 08:01 44769413 /usr/lib/libpython2.6.so.1.0
7fbcdf414000-7fbcdf416000 r--p 00232000 08:01 44769413 /usr/lib/libpython2.6.so.1.0
7fbcdf416000-7fbcdf477000 rw-p 00234000 08:01 44769413 /usr/lib/libpython2.6.so.1.0
7fbcdf477000-7fbcdf486000 rw-p 00000000 00:00 0
7fbcdf486000-7fbcdf497000 r-xp 00000000 08:01 42188802 /usr/lib/python2.6/dist-packages/_pokereval_2_6.so.1.0.0
7fbcdf497000-7fbcdf696000 ---p 00011000 08:01 42188802 /usr/lib/python2.6/dist-packages/_pokereval_2_6.so.1.0.0
7fbcdf696000-7fbcdf697000 r--p 00010000 08:01 42188802 /usr/lib/python2.6/dist-packages/_pokereval_2_6.so.1.0.0
7fbcdf697000-7fbcdf698000 rw-p 00011000 08:01 42188802 /usr/lib/python2.6/dist-packages/_pokereval_2_6.so.1.0.0
7fbcdf698000-7fbcdf69f000 r-xp 00000000 08:01 24690691 /usr/lib/python2.6/lib-dynload/_ssl.so
7fbcdf69f000-7fbcdf89e000 ---p 00007000 08:01 24690691 /usr/lib/python2.6/lib-dynload/_ssl.so
7fbcdf89e000-7fbcdf89f000 r--p 00006000 08:01 24690691 /usr/lib/python2.6/lib-dynload/_ssl.so
7fbcdf89f000-7fbcdf8a0000 rw-p 00007000 08:01 24690691 /usr/lib/python2.6/lib-dynload/_ssl.so
7fbcdf8a0000-7fbcdf8a3000 r-xp 00000000 08:01 24692517 /usr/lib/python2.6/lib-dynload/_lsprof.so
7fbcdf8a3000-7fbcdfaa3000 ---p 00003000 08:01 24692517 /usr/lib/python2.6/lib-dynload/_lsprof.so
7fbcdfaa3000-7fbcdfaa4000 r--p 00003000 08:01 24692517 /usr/lib/python2.6/lib-dynload/_lsprof.so
7fbcdfaa4000-7fbcdfaa5000 rw-p 00004000 08:01 24692517 /usr/lib/python2.6/lib-dynload/_lsprof.so
7fbcdfaa5000-7fbcdfac2000 r-xp 00000000 08:01 24692556 /usr/lib/python2.6/lib-dynload/_ctypes.so
7fbcdfac2000-7fbcdfcc1000 ---p 0001d000 08:01 24692556 /usr/lib/python2.6/lib-dynload/_ctypes.so
7fbcdfcc1000-7fbcdfcc2000 r--p 0001c000 08:01 24692556 /usr/lib/python2.6/lib-dynload/_ctypes.so
7fbcdfcc2000-7fbcdfcc6000 rw-p 0001d000 08:01 24692556 /usr/lib/python2.6/lib-dynload/_ctypes.so
7fbcdfcc6000-7fbcdfcc8000 r-xp 00000000 08:01 24692530 /usr/lib/python2.6/lib-dynload/resource.so
7fbcdfcc8000-7fbcdfec7000 ---p 00002000 08:01 24692530 /usr/lib/python2.6/lib-dynload/resource.so
7fbcdfec7000-7fbcdfec8000 r--p 00001000 08:01 24692530 /usr/lib/python2.6/lib-dynload/resource.so
7fbcdfec8000-7fbcdfec9000 rw-p 00002000 08:01 24692530 /usr/lib/python2.6/lib-dynload/resource.so
7fbcdfec9000-7fbcdff07000 r-xp 00000000 08:01 3342414 /lib/libncurses.so.5.7
7fbcdff07000-7fbce0107000 ---p 0003e000 08:01 3342414 /lib/libncurses.so.5.7
7fbce0107000-7fbce010b000 r--p 0003e000 08:01 3342414 /lib/libncurses.so.5.7
7fbce010b000-7fbce010c000 rw-p 00042000 08:01 3342414 /lib/libncurses.so.5.7
7fbce010c000-7fbce0144000 r-xp 00000000 08:01 3343933 /lib/libreadline.so.6.0
7fbce0144000-7fbce0343000 ---p 00038000 08:01 3343933 /lib/libreadline.so.6.0
7fbce0343000-7fbce0345000 r--p 00037000 08:01 3343933 /lib/libreadline.so.6.0
7fbce0345000-7fbce034b000 rw-p 00039000 08:01 3343933 /lib/libreadline.so.6.0
7fbce034b000-7fbce034c000 rw-p 00000000 00:00 0
7fbce034c000-7fbce0351000 r-xp 00000000 08:01 24692521 /usr/lib/python2.6/lib-dynload/readline.so

fish: Job 1, “ipython” terminated by signal SIGABRT (Abort)

Revision history for this message
mathrawka (jon-licq) wrote :

I am able to use a 32-bit version of pypoker-eval 1.35.0-1 without the coredump. Downgrading to 1.35.0-1 does not help when using the amd 64-bit version.

Revision history for this message
mathrawka (jon-licq) wrote :

The problem is that it poker-eval uses sizeof(int) for an int pointer, which is 4 bytes on 64-bit CPU but it should be 8 bytes.

Here is a simple patch to enumerate.h that will make fix poker-eval, and cause pypoker-eval to not crash.

Can you please use this to make a new package?

624c623
< _curElem = (int **) malloc(num_sets * sizeof(int)); \
---
> _curElem = (int **) malloc(num_sets * sizeof(intptr_t)); \

Revision history for this message
mathrawka (jon-licq) wrote :

Patch has been committed upstream as r6402.

How can we get a new build of this package for ubuntu with this bugfix? I'm currently building it on my own and copying the files to my server, but this isn't ideal...

Revision history for this message
Johan Euphrosine (proppy) wrote :

One could ask the debian maintainer to publish a new version in debian:
http://packages.qa.debian.org/p/poker-eval.html

And then ask for a sync in next ubuntu version Lucid, by filling a new bug report:
https://wiki.ubuntu.com/SyncRequestProcess

Or one can add the patch to the current ubuntu packages, in debian/patches using cdbs-simplepatchsys and attach a debdiff to this ticket.

Revision history for this message
Loic Dachary (dachary) wrote :

This is a poker-eval bug, not a pypoker-eval bug

affects: pypoker-eval (Ubuntu) → poker-eval (Ubuntu)
Changed in poker-eval (Ubuntu):
assignee: nobody → Loic Dachary (loic-launchpad-net)
status: New → Fix Released
Revision history for this message
Loic Dachary (dachary) wrote :

Maverick has version 137.0 in which the bug was fixed.

2010-02-10 Loic Dachary <email address hidden>

 * Release 137.0

 * include/enumerate.h: Apply 64bits fix from
   https://bugs.launchpad.net/ubuntu/+source/pypoker-eval/+bug/508739/comments/2

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.