Skip to content

Commit bc313f5

Browse files
committed
Merge branch 'grapheme_fix' into PHP-5.3
* grapheme_fix: fix bug #61487 - bad bounds check in grapheme_strpos
2 parents 4c478f9 + cd9cd36 commit bc313f5

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ext/intl/grapheme/grapheme_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ UBreakIterator*
5454
grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC );
5555

5656
/* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */
57-
#define OUTSIDE_STRING(offset, max_len) ( offset < INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (long) max_len : offset >= (long) max_len) )
57+
#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (long) max_len : offset >= (long) max_len) )
5858

5959
#endif // GRAPHEME_GRAPHEME_UTIL_H

ext/intl/tests/bug61487.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
grapheme() str[i]pos limits
3+
--SKIPIF--
4+
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5+
--FILE--
6+
<?php
7+
var_dump(grapheme_stripos(1,1,2147483648));
8+
var_dump(grapheme_strpos(1,1,2147483648));
9+
--EXPECT--
10+
bool(false)
11+
bool(false)

0 commit comments

Comments
 (0)