com php-src: fix bug #61487 - bad bounds check in grapheme_st rpos: ext/intl/grapheme/grapheme_util.h ext/intl/test s/bug61487.phpt
| From: | Stanislav Malyshev | Date: | Fri, 23 Mar 2012 07:26:33 +0000 |
| Subject: | com php-src: fix bug #61487 - bad bounds check in grapheme_st rpos: ext/intl/grapheme/grapheme_util.h ext/intl/test s/bug61487.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-68194@lists.php.net to get a copy of this message | ||
Commit: cd9cd36d7e81af19eba3631b371ec40658874a8b
Author: Stanislav Malyshev <stas@php.net> Fri, 23 Mar 2012 00:26:33 -0700
Parents: da2da13f935b2775635cd21b47a78fbf025a462d
Branches: PHP-5.3
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cd9cd36d7e81af19eba3631b371ec40658874a8b
Log:
fix bug #61487 - bad bounds check in grapheme_strpos
Bugs:
https://bugs.php.net/61487
Changed paths:
M ext/intl/grapheme/grapheme_util.h
A ext/intl/tests/bug61487.phpt
Diff:
cd9cd36d7e81af19eba3631b371ec40658874a8b
diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h
index 675c648..c91aeaf 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 0000000..361debe
--- /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)