[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-php PATCH] Use zend_long instead of zend_ulong64



In PHP 7.0, the zend_(u)long64 definition was removed in favor
of zend_(u)long changing depending on whether PHP was compiled on
a 64-bit architecture or not.

The patch set that originally ported libvirt-php to PHP7+ did not
use zend_ulong64. However, it was altered to use it during the review,
which broke PHP 7.0 support. This fixes that by using zend_long and
checking for if the value is invalid and returning false when that happens.
---
 src/libvirt-php.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 7dcead8..435bf97 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -6666,11 +6666,12 @@ PHP_FUNCTION(libvirt_domain_memory_peek)
     zval *zdomain;
     int retval;
     zend_long flags=0;
-    zend_ulong64 start;
+    zend_long start;
     zend_long size;
     char *buff;
 
     GET_DOMAIN_FROM_ARGS("rlll",&zdomain,&start,&size,&flags);
+    if (start < 0) RETURN_FALSE;
     buff=(char *)emalloc(size);
     retval=virDomainMemoryPeek(domain->domain,start,size,buff,flags);
     if (retval != 0) RETURN_FALSE;
-- 
2.5.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]