[Python-3000] binascii.b2a_qp() in the p3yk branch

Guido van Rossum guido at python.org
Wed May 9 19:56:19 CEST 2007


Fixed. The code was using strchr() instead of memchr(), which was
wrong anyway; but b"" is the only object (apparently) whose buffer
pointer is NULL when the size is 0.

Committed revision 55204.

Please backport (I wouldn't be surprised if this could be exploited).

On 5/9/07, Walter Dörwald <walter at livinglogic.de> wrote:
> binascii.b2a_qp() in the p3yk branch is broken. What I get is:
>
> $ gdb ./python
> GNU gdb 6.3-debian
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i386-linux"...Using host libthread_db
> library "/lib/tls/libthread_db.so.1".
>
> (gdb) run
> Starting program: /var/home/walter/checkouts/Python/p3yk/python
> [Thread debugging using libthread_db enabled]
> [New Thread -1209593088 (LWP 17690)]
> Python 3.0x (p3yk:55200, May  9 2007, 11:43:49)
> [GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import binascii
>  >>> binascii.b2a_qp(b'')
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1209593088 (LWP 17690)]
> 0xb7ee9093 in strchr () from /lib/tls/libc.so.6
> (gdb) bt
> #0  0xb7ee9093 in strchr () from /lib/tls/libc.so.6
> #1  0xb7c4744c in binascii_b2a_qp (self=0x0, args=0x0, kwargs=0x0) at
> /var/home/walter/checkouts/Python/p3yk/Modules/binascii.c:1153
> #2  0x0807788e in PyCFunction_Call (func=0xb7e26e8c, arg=0xb7e1328c,
> kw=0xa0a0a0a) at Objects/methodobject.c:77
> #3  0x080adbb4 in call_function (pp_stack=0xbffff45c, oparg=0) at
> Python/ceval.c:3513
> #4  0x080abe66 in PyEval_EvalFrameEx (f=0x8235aa4, throwflag=0) at
> Python/ceval.c:2191
> #5  0x080ac9e4 in PyEval_EvalCodeEx (co=0xb7e0fbf0, globals=0x0,
> locals=0xa0a0a0a, args=0xb7e3102c, argcount=0, kws=0x0, kwcount=0,
> defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at Python/ceval.c:2812
> #6  0x080aef5f in PyEval_EvalCode (co=0x0, globals=0x0, locals=0x0) at
> Python/ceval.c:491
> #7  0x080d14ba in run_mod (mod=0x0, filename=0x0, globals=0x0,
> locals=0x0, flags=0x0, arena=0x0) at Python/pythonrun.c:1282
> #8  0x080d0967 in PyRun_InteractiveOneFlags (fp=0x0, filename=0x8116596
> "<stdin>", flags=0xbffff65c) at Python/pythonrun.c:800
> #9  0x080d0793 in PyRun_InteractiveLoopFlags (fp=0xb7f9cca0,
> filename=0x8116596 "<stdin>", flags=0xbffff65c) at Python/pythonrun.c:724
> #10 0x080d1d32 in PyRun_AnyFileExFlags (fp=0xb7f9cca0,
> filename=0x8116596 "<stdin>", closeit=0, flags=0xbffff65c) at
> Python/pythonrun.c:693
> #11 0x080569ab in Py_Main (argc=-1208365920, argv=0xbffff65c) at
> Modules/main.c:491
> #12 0x080564bb in main (argc=0, argv=0x0) at Modules/python.c:23
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list