com php-src: fix signed/unsigned mismatch: ext/spl/spl_direct ory.c
| From: | Anatol Belski | Date: | Tue, 16 Sep 2014 19:17:25 +0000 |
| Subject: | com php-src: fix signed/unsigned mismatch: ext/spl/spl_direct ory.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81696@lists.php.net to get a copy of this message | ||
Commit: fc6f7bfcf36a313d712bb08b0fae6a1d793c0333
Author: Anatol Belski <ab@php.net> Tue, 16 Sep 2014 20:44:45 +0200
Parents: 5777aa51d9a8cfdb1f87401925b00a305e54e8b5
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fc6f7bfcf36a313d712bb08b0fae6a1d793c0333
Log:
fix signed/unsigned mismatch
Changed paths:
M ext/spl/spl_directory.c
Diff:
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 0694e8f..293be0b 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -2883,7 +2883,12 @@ SPL_METHOD(SplFileObject, fwrite)
}
if (ZEND_NUM_ARGS() > 1) {
- str_len = MAX(0, MIN(length, str_len));
+ if (length >= 0) {
+ str_len = MAX(0, MIN((size_t)length, str_len));
+ } else {
+ /* Negative length given, nothing to write */
+ str_len = 0;
+ }
}
if (!str_len) {
RETURN_LONG(0);