]> granicus.if.org Git - php/commitdiff
Fix VirtualProtect memory size
authorAnatol Belski <ab@php.net>
Thu, 11 Apr 2019 13:42:22 +0000 (15:42 +0200)
committerAnatol Belski <ab@php.net>
Thu, 11 Apr 2019 13:46:46 +0000 (15:46 +0200)
As otherwise it would remove executable flag from JIT memory

Thanks Dmitry for the hint :)

ext/opcache/zend_shared_alloc.c

index ade01af4f5313e3718c4159eb8db60817c6b1f6d..1ab7f774edff06d92a1c1cdd7bcb1b7f852fecf0 100644 (file)
@@ -626,7 +626,7 @@ void zend_accel_shared_protect(int mode)
 
        for (i = 0; i < ZSMMG(shared_segments_count); i++) {
                DWORD oldProtect;
-               if (!VirtualProtect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->size, mode, &oldProtect)) {
+               if (!VirtualProtect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->end, mode, &oldProtect)) {
                        zend_accel_error(ACCEL_LOG_ERROR, "Failed to protect memory");
                }
        }