summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2012-03-25 01:03:02 -0700
committerStanislav Malyshev <stas@php.net>2012-03-25 01:03:02 -0700
commitbc313f5e804c0d01aafd016b0704d7ea7681e05e (patch)
treeb09184a876ccabe2b49742e37bcabeea0787d9e6
parent4c478f9ca698c2f990a521b084281bdd01b02d02 (diff)
parentcd9cd36d7e81af19eba3631b371ec40658874a8b (diff)
downloadphp-git-bc313f5e804c0d01aafd016b0704d7ea7681e05e.tar.gz
Merge branch 'grapheme_fix' into PHP-5.3
* grapheme_fix: 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)