summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2012-03-25 01:03:25 -0700
committerStanislav Malyshev <stas@php.net>2012-03-25 01:03:25 -0700
commit2bd5fa0eda9a55b617b83ac3db6b8b7ca6190275 (patch)
tree6da99676b17060415c7bf536182fe0282b1457be
parentcdfef0aee4498e500d799c3e725abe8e95dba774 (diff)
parentbc313f5e804c0d01aafd016b0704d7ea7681e05e (diff)
downloadphp-git-2bd5fa0eda9a55b617b83ac3db6b8b7ca6190275.tar.gz
Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3: fix bug #61487 - bad bounds check in grapheme_strpos
-rwxr-xr-xext/intl/grapheme/grapheme_util.h2
-rw-r--r--ext/intl/tests/bug61487.phpt11
2 files changed, 12 insertions, 1 deletions
diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h
index 675c6481b7..c91aeaff7d 100755
--- a/ext/intl/grapheme/grapheme_util.h
+++ b/ext/intl/grapheme/grapheme_util.h
@@ -54,6 +54,6 @@ UBreakIterator*
grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC );
/* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */
-#define OUTSIDE_STRING(offset, max_len) ( offset < INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (long) max_len : offset >= (long) max_len) )
+#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (long) max_len : offset >= (long) max_len) )
#endif // GRAPHEME_GRAPHEME_UTIL_H
diff --git a/ext/intl/tests/bug61487.phpt b/ext/intl/tests/bug61487.phpt
new file mode 100644
index 0000000000..361debe408
--- /dev/null
+++ b/ext/intl/tests/bug61487.phpt
@@ -0,0 +1,11 @@
+--TEST--
+grapheme() str[i]pos limits
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+var_dump(grapheme_stripos(1,1,2147483648));
+var_dump(grapheme_strpos(1,1,2147483648));
+--EXPECT--
+bool(false)
+bool(false)