[PHP-CVS] cvs: php-src(PHP_5_2) /ext/mbstring/libmbfl/mbfl mbfilter.c

2009-02-14 Thread Moriyoshi Koizumi
moriyoshi   Sat Feb 14 08:16:21 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/mbstring/libmbfl/mbfl  mbfilter.c 
  Log:
  - MFH: prevent unwanted overflow
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c?r1=1.7.2.5.2.4&r2=1.7.2.5.2.5&diff_format=u
Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c
diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5.2.4 
php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5.2.5
--- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5.2.4Sat Feb 14 
07:35:01 2009
+++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.cSat Feb 14 08:16:21 2009
@@ -906,6 +906,9 @@
 
if (offset < 0) {
negative_offset = -offset - pc.needle_len;
+   if (negative_offset < 0) {
+   negative_offset = 0;
+   }
offset = 0;
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/mbstring/libmbfl/mbfl mbfilter.c

2007-08-18 Thread Rui Hirokawa
hirokawaSun Aug 19 01:58:39 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/mbstring/libmbfl/mbfl  mbfilter.c 
  Log:
  MFH (fixed #42085)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c?r1=1.7.2.5&r2=1.7.2.5.2.1&diff_format=u
Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c
diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5 
php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5.2.1
--- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5Tue Mar 21 
07:56:28 2006
+++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.cSun Aug 19 01:58:39 2007
@@ -858,7 +858,7 @@
 int offset,
 int reverse)
 {
-   int n, result;
+   int n, result, negative_offset = 0;
unsigned char *p;
mbfl_convert_filter *filter;
struct collector_strpos_data pc;
@@ -904,6 +904,12 @@
mbfl_wchar_device_clear(&pc.needle);
return -4;
}
+
+   if (offset < 0) {
+   negative_offset = -offset-1;
+   offset = 0;
+   }
+
pc.start = offset;
pc.output = 0;
pc.needle_pos = 0;
@@ -912,7 +918,7 @@
 
/* feed data */
p = haystack->val;
-   n = haystack->len;
+   n = haystack->len - negative_offset;
if (p != NULL) {
while (n > 0) {
if ((*filter->filter_function)(*p++, filter) < 0) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php