Buffer Overflow with Python 2.5 on Vista in import site

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fuzzyman

    Buffer Overflow with Python 2.5 on Vista in import site

    A very odd error with Python 2.5 (both 2.5.1 and 2.5.2 from the
    official msi installers and running on Vista under Parallels on the
    Mac).

    'import site' fails due to a string in sys.path that contains a huge
    number of null bytes.

    The error is actually in ntpath - I adjusted it to print the paths it
    is working with and a string on encountering the bad path.

    Because 'import site' is executed twice with the following code I
    snipped the first dump and only print the one with the traceback:

    C:\Users\Admini strator>python -c "import site"

    [snip]

    'import site' failed; use -v for traceback
    set(['c:\\python25\\ lib\\plat-win', 'c:\\windows\\s ystem32\
    \python25.zip', 'c:\\
    python25', 'c:\\python25\\ lib\\lib-tk', 'c:\\users\\adm inistrator', 'c:
    \\python2
    5\\dlls', 'c:\\python25\\ lib', 'c:\\python25\\ lib\\site-packages'])

    *************** ***** BAD PATH *************** *****
    "C:\\Python25\\ lib\\site-packages\\\x00\ x05\x16\x07\x00 \x02\x00\x00Mac
    OS X
    \x00\x02\x00\x0 0\x00\t\x00\x00 \x002\x00\x00\x 0e
    \xb0\x00\x00\x0 0\x02\x00\x00\x
    0e\xe2\x00\x00\ x01\x1e
    \x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x00\ x00\x00\x00\x
    00\x00\x00\x00\ x00\x00\x00\x00 \x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x00\ x00AT
    TR\x00\x00\x00! \x00\x00\x0e\xe 2\x00\x00\x00\x 98\x00\x00\x00
    \x00\x00\x00\x0 0\x00
    \x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x01\ x00\x00\x00\x98 \x00\x00\x00
    \x00\x0
    0\x15com.macrom ates.caret\x00x \x9c\xab\xe6R\x 00\x82\xe4\xfc\ x9c
    \xd2\xdc<\x05[\x0
    5\x03k0?'3/\x15\xc2\xab\x0 5\x00\x8b\x99\x 08\x1d
    \x00\x00\x00\x0 0\x00\x00\x00\x 00\
    x00\x00\x00\x00 \x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x00\ x00\x00\x00\x00 \x00\
    x00\x00\x00\x00 \x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x00\ x00\x00\x00\x00 \x00\

    [snip a load of null bytes]

    x00\x00\x00\x00 \x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x00\ x00\x00\x00\x00 \x00\
    x01\x00\x00\x00 \x01\x00\x00\x0 0\x00\x00\x00\x 00\x00\x1eThis resource
    fork intent
    ionally left blank
    \x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x00\ x00\x00\x00\x0

    [snip a load more null bytes]

    0\x00\x00\x00\x 00\x00\x00\x00\ x00\x00\x00\x00 \x00\x00\x00\x0 0\x00\x00\x00\x 00\x0
    0\x00\x01\x00\x 00\x00\x01\x00\ x00\x00\x00\x00 \x00\x00\x00\x1 e
    \x00\x00\x00\x0 0\x0
    0\x00\x00\x00\x 00\x1c\x00\x1e\ xff\xff"
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Python25\li b\site.py", line 417, in <module>
    main()
    File "C:\Python25\li b\site.py", line 402, in main
    paths_in_sys = addsitepackages (paths_in_sys)
    File "C:\Python25\li b\site.py", line 206, in addsitepackages
    addsitedir(site dir, known_paths)
    File "C:\Python25\li b\site.py", line 169, in addsitedir
    addpackage(site dir, name, known_paths)
    File "C:\Python25\li b\site.py", line 141, in addpackage
    dir, dircase = makepath(sitedi r, line)
    File "C:\Python25\li b\site.py", line 67, in makepath
    dir = os.path.abspath (os.path.join(* paths))
    File "C:\Python25\li b\ntpath.py", line 500, in abspath
    path = _getfullpathnam e(path)
    TypeError: _getfullpathnam e() argument 1 must be (buffer overflow),
    not str


    Odd. Anyone got any clues?

    Michael Foord
    Pedestrian accidents can happen in the blink of an eye, changing lives forever. When you're out for a stroll or crossing the street, an unexpected collision

  • Gabriel Genellina

    #2
    Re: Buffer Overflow with Python 2.5 on Vista in import site

    En Sat, 29 Mar 2008 17:34:27 -0300, Fuzzyman <fuzzyman@gmail .comescribió:
    A very odd error with Python 2.5 (both 2.5.1 and 2.5.2 from the
    official msi installers and running on Vista under Parallels on the
    Mac).
    It may be actually a Parallels issue - I've installed 2.5.1 on Vista (just
    once, on a real PC) and it worked fine. Anyway a better place for bug
    reports is bugs.python.org

    Mmm, maybe you should check all your .pth files - looks like this strange
    path comes from one of them.

    --
    Gabriel Genellina

    Comment

    • Fuzzyman

      #3
      Re: Buffer Overflow with Python 2.5 on Vista in import site

      On Mar 30, 3:53 am, "Gabriel Genellina" <gagsl-...@yahoo.com.a r>
      wrote:
      En Sat, 29 Mar 2008 17:34:27 -0300, Fuzzyman <fuzzy...@gmail .comescribió:
      >
      A very odd error with Python 2.5 (both 2.5.1 and 2.5.2 from the
      official msi installers and running on Vista under Parallels on the
      Mac).
      >
      It may be actually a Parallels issue - I've installed 2.5.1 on Vista (just
      once, on a real PC) and it worked fine. Anyway a better place for bug
      reports is bugs.python.org
      >
      Mmm, maybe you should check all your .pth files - looks like this strange
      path comes from one of them.

      I think it comes from the '._something.pt h' that Textmate created as a
      temporary file when I edited a 'pth' file. The 'macromates' text in
      their is from textmate. I'm not sure if it is Mac specific or Texmate
      specific, but those temp files are really annoying.

      Thanks.

      Michael
      Pedestrian accidents can happen in the blink of an eye, changing lives forever. When you're out for a stroll or crossing the street, an unexpected collision

      >
      --
      Gabriel Genellina

      Comment

      Working...