com php-src: Fix coverity issue with -1 returned by findOffset not being handled by getPreferredTag: ext/intl/locale/locale_methods. c
| From: | Stanislav Malyshev | Date: | Mon, 21 Oct 2013 06:04:16 +0000 |
| Subject: | com php-src: Fix coverity issue with -1 returned by findOffset not being handled by getPreferredTag: ext/intl/locale/locale_methods. c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73751@lists.php.net to get a copy of this message | ||
Commit: 297324146e772fc41d79c23511f66d7d66f6784c
Author: Stanislav Malyshev <stas@php.net> Sun, 20 Oct 2013 22:04:21 -0700
Parents: 27ebcb8d0e2f657ffe666a8ea4a81ae7a9b15cd1
Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=297324146e772fc41d79c23511f66d7d66f6784c
Log:
Fix coverity issue with -1 returned by findOffset not being handled by getPreferredTag
Changed paths:
M ext/intl/locale/locale_methods.c
Diff:
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 1707c69..9c5b09a 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -127,6 +127,9 @@ static char* getPreferredTag(char* gf_tag)
int grOffset = 0;
grOffset = findOffset( LOC_GRANDFATHERED ,gf_tag);
+ if(grOffset < 0) {
+ return NULL;
+ }
if( grOffset < LOC_PREFERRED_GRANDFATHERED_LEN ){
/* return preferred tag */
result = estrdup( LOC_PREFERRED_GRANDFATHERED[grOffset] );