
On 15.04.2016 12:10, Neal Gompa wrote:
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;
I'd set an error message here at least, so users know why the call failed.
buff=(char *)emalloc(size); retval=virDomainMemoryPeek(domain->domain,start,size,buff,flags); if (retval != 0) RETURN_FALSE;
I'm squashing this in and pushing: diff --git a/src/libvirt-php.c b/src/libvirt-php.c index 435bf97..e716c61 100644 --- a/src/libvirt-php.c +++ b/src/libvirt-php.c @@ -6671,7 +6671,10 @@ PHP_FUNCTION(libvirt_domain_memory_peek) char *buff; GET_DOMAIN_FROM_ARGS("rlll",&zdomain,&start,&size,&flags); - if (start < 0) RETURN_FALSE; + if (start < 0) { + set_error("Invalid arguments" TSRMLS_CC); + RETURN_FALSE; + } buff=(char *)emalloc(size); retval=virDomainMemoryPeek(domain->domain,start,size,buff,flags); if (retval != 0) RETURN_FALSE; Michal