[Python-checkins] r83859 - in python/branches/py3k: Misc/NEWS Objects/stringlib/fastsearch.h

florent.xicluna python-checkins at python.org
Mon Aug 9 00:07:16 CEST 2010


Author: florent.xicluna
Date: Mon Aug  9 00:07:16 2010
New Revision: 83859

Log:
Fix #8530: Prevent stringlib fastsearch from reading beyond the front of an array.


Modified:
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Objects/stringlib/fastsearch.h

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Mon Aug  9 00:07:16 2010
@@ -12,6 +12,9 @@
 Core and Builtins
 -----------------
 
+- Issue #8530: Prevent stringlib fastsearch from reading beyond the front
+  of an array.
+
 - Issue #5319: Print an error if flushing stdout fails at interpreter
   shutdown.
 

Modified: python/branches/py3k/Objects/stringlib/fastsearch.h
==============================================================================
--- python/branches/py3k/Objects/stringlib/fastsearch.h	(original)
+++ python/branches/py3k/Objects/stringlib/fastsearch.h	Mon Aug  9 00:07:16 2010
@@ -140,13 +140,13 @@
                     /* got a match! */
                     return i;
                 /* miss: check if previous character is part of pattern */
-                if (!STRINGLIB_BLOOM(mask, s[i-1]))
+                if (i > 0 && !STRINGLIB_BLOOM(mask, s[i-1]))
                     i = i - m;
                 else
                     i = i - skip;
             } else {
                 /* skip: check if previous character is part of pattern */
-                if (!STRINGLIB_BLOOM(mask, s[i-1]))
+                if (i > 0 && !STRINGLIB_BLOOM(mask, s[i-1]))
                     i = i - m;
             }
         }


More information about the Python-checkins mailing list