[issue3967] bytearray().count()

2008-09-26 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Committed in trunk: r66631, in release25-maint: r66632 and py3k: r66633. -- resolution: -> fixed status: open -> closed ___ Python tracker <[EMAIL PROTECTED]>

[issue3967] bytearray().count()

2008-09-26 Thread STINNER Victor
STINNER Victor <[EMAIL PROTECTED]> added the comment: Fixed in Python trunk, rev66631, by amaury.forgeotdarc. ___ Python tracker <[EMAIL PROTECTED]> ___

[issue3967] bytearray().count()

2008-09-26 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: I think the patch is good. -- nosy: +benjamin.peterson ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue3967] bytearray().count()

2008-09-25 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: All versions are involved. Even 2.4 has surprises: >>> "aa".count("", sys.maxint, 0) -2147483646 -- versions: +Python 2.5, Python 3.0 ___ Python tracker <[EMAIL PROTECTED]>

[issue3967] bytearray().count()

2008-09-25 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Ah, big numbers that overflow: even if 'start' is (silently) capped to sys.maxint-1,len(b)-start-len("xx") will wrap and yield a positive number... The find/rfind/index/rindex methods have the same problem. Attached a patch an

[issue3967] bytearray().count()

2008-09-25 Thread STINNER Victor
STINNER Victor <[EMAIL PROTECTED]> added the comment: Here is a trace of Valgrind: >>> b=bytearray(2) >>> b.count("", 3493403, 0) 0 >>> b.count("", 23131230123012010231023, 0) ==13650== Invalid read of size 1 ==13650==at 0x812718A: fastsearch (fastsearch.h:67) ==13650==by 0x81

[issue3967] bytearray().count()

2008-09-25 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Is there a problem, a potential crash? looking at the code, I could not find any: in fastsearch, the "if (w < 0)" will quickly exit the function, without reading the contents of the array. -- nosy: +amaury.forgeotdarc ___

[issue3967] bytearray().count()

2008-09-25 Thread STINNER Victor
New submission from STINNER Victor <[EMAIL PROTECTED]>: bytes_count() doesn't check start maximum value: _adjust_indices() should check that start is smaller than len (smaller or egal? len or len-1?). Example: >>> b = bytearray(3) >>> b.count("x", 1491491034, 0) start=1491491034 should be repla