ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ctypes-users
ctypes-users
Re: [ctypes-users] bug report: int overflow in ctypeslib
by Thomas Heller other posts by this author
Nov 23 2006 2:08AM messages near this date
[ctypes-users] bug report: int overflow in ctypeslib | [ctypes-users] Since I don't seem to be getting time to do the rest of the work any time soon
Daniele Varrazzo schrieb:
>  Hello,
>  
>  while i was wrapping the SpiderMonkey library, ctypeslib crashed in two 
>  distinct points (but for the same reason): converting t.max into int 
>  when isinstance(t, typedesc.ArrayType). When t.max is the string 
>  "0xffffffffffffffff", int(t.max) fails with a ValueError. Tested with 
>  Python 2.4.3 on a 32 bit Gentoo system. int(t.max, 16) works fine anyway.
>  
>  The crash happens on both lines 66 and 214 in 
>  ctypeslib/codegen/codegenerator.py  (revision 52818) when calling 
>  xml2py. the offending structure is in gconv.h. Even with the patch on, 
>  the __gconv_info structure generates a warning (packing fails)
>  
>  The steps to reproduce the bugs on Linux are: (sorry if i don't reduce 
>  the matter to fewer steps, but i'm just starting with ctypes and i don't 
>  know where to start pruning)
[...]

Thanks for the report.  The problem is what gccxml generates for arrays with
unspecified sizes, in these C constructs:

extern char array[];
struct {
    char abc[];
};

I fixed the problem in SVN in a different way than your patch (this also fixes the 'packing
fails' warning), by special casing on the 't.max' values that come out of the XML file.

With the fixed version I can now successfully convert gconh.h into a Python module.

Thanks,
Thomas


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
ctypes-users mailing list
ctypes-users@[...].net
https://lists.sourceforge.net/lists/listinfo/ctypes-users
Thread:
Daniele Varrazzo
Thomas Heller

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved