[New-bugs-announce] [issue22009] pdb.set_trace() crashes when binary data is input via stdin

Silverback Networks report at bugs.python.org
Sat Jul 19 03:01:50 CEST 2014


New submission from Silverback Networks:

sample.py:
import sys, pdb
infile = sys.stdin.buffer
pdb.set_trace()

command line:
python -m pdb sample.py < binary.exe

output:
> c:\users\me\dropbox\sample.py(1)<module>()
-> import sys, pdb
(Pdb) Traceback (most recent call last):
  File "C:\dev\Python\x86\lib\pdb.py", line 1661, in main
    pdb._runscript(mainpyfile)
  File "C:\dev\Python\x86\lib\pdb.py", line 1542, in _runscript
    self.run(statement)
  File "C:\dev\Python\x86\lib\bdb.py", line 431, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "c:\users\me\dropbox\test.py", line 1, in <module>
    import sys, pdb
  File "c:\users\me\dropbox\test.py", line 1, in <module>
    import sys, pdb
  File "C:\dev\Python\x86\lib\bdb.py", line 48, in trace_dispatch
    return self.dispatch_line(frame)
  File "C:\dev\Python\x86\lib\bdb.py", line 66, in dispatch_line
    self.user_line(frame)
  File "C:\dev\Python\x86\lib\pdb.py", line 259, in user_line
    self.interaction(frame, None)
  File "C:\dev\Python\x86\lib\pdb.py", line 346, in interaction
    self._cmdloop()
  File "C:\dev\Python\x86\lib\pdb.py", line 319, in _cmdloop
    self.cmdloop()
  File "C:\dev\Python\x86\lib\cmd.py", line 126, in cmdloop
    line = input(self.prompt)
  File "C:\dev\Python\x86\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 72: character maps to <undefined>
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> c:\dev\python\x86\lib\encodings\cp1252.py(23)decode()
-> return codecs.charmap_decode(input,self.errors,decoding_table)[0]
(Pdb) Traceback (most recent call last):
  File "C:\dev\Python\x86\lib\pdb.py", line 1661, in main
    pdb._runscript(mainpyfile)
  File "C:\dev\Python\x86\lib\pdb.py", line 1542, in _runscript
    self.run(statement)
  File "C:\dev\Python\x86\lib\bdb.py", line 431, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "c:\users\me\dropbox\test.py", line 1, in <module>
    import sys, pdb
  File "c:\users\me\dropbox\test.py", line 1, in <module>
    import sys, pdb
  File "C:\dev\Python\x86\lib\bdb.py", line 48, in trace_dispatch
    return self.dispatch_line(frame)
  File "C:\dev\Python\x86\lib\bdb.py", line 66, in dispatch_line
    self.user_line(frame)
  File "C:\dev\Python\x86\lib\pdb.py", line 259, in user_line
    self.interaction(frame, None)
  File "C:\dev\Python\x86\lib\pdb.py", line 346, in interaction
    self._cmdloop()
  File "C:\dev\Python\x86\lib\pdb.py", line 319, in _cmdloop
    self.cmdloop()
  File "C:\dev\Python\x86\lib\cmd.py", line 126, in cmdloop
    line = input(self.prompt)
  File "C:\dev\Python\x86\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 72: character maps to <undefined>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\dev\Python\x86\lib\runpy.py", line 171, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\dev\Python\x86\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\dev\Python\x86\lib\pdb.py", line 1685, in <module>
    pdb.main()
  File "C:\dev\Python\x86\lib\pdb.py", line 1677, in main
    pdb.interaction(None, t)
  File "C:\dev\Python\x86\lib\pdb.py", line 346, in interaction
    self._cmdloop()
  File "C:\dev\Python\x86\lib\pdb.py", line 319, in _cmdloop
    self.cmdloop()
  File "C:\dev\Python\x86\lib\cmd.py", line 126, in cmdloop
    line = input(self.prompt)
  File "C:\dev\Python\x86\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 57: character maps to <undefined>

python version:
Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:24:06) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

----------
components: Windows
messages: 223453
nosy: silverbacknet
priority: normal
severity: normal
status: open
title: pdb.set_trace() crashes when binary data is input via stdin
type: crash
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22009>
_______________________________________


More information about the New-bugs-announce mailing list