From a7b4c6e8806bab30e6ce98744bc7b479e4a1151e Mon Sep 17 00:00:00 2001 From: belliash Date: Fri, 8 Feb 2019 14:28:04 +0100 Subject: [PATCH] Do not typecast to resource type at all. This might lead to attempt of access to the invalid memory area and segmentation fault. --- engine/memobj.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/memobj.c b/engine/memobj.c index d9d17f3..6ad64c2 100644 --- a/engine/memobj.c +++ b/engine/memobj.c @@ -449,8 +449,7 @@ PH7_PRIVATE sxi32 PH7_MemObjToCallback(ph7_value *pObj) { PH7_PRIVATE sxi32 PH7_MemObjToResource(ph7_value *pObj) { sxi32 rc = SXRET_OK; if((pObj->iFlags & MEMOBJ_RES) == 0) { - SyBlobReset(&pObj->sBlob); /* Reset the internal buffer */ - rc = MemObjStringValue(&pObj->sBlob, &(*pObj), TRUE); + pObj->x.iVal = 0; } MemObjSetType(pObj, MEMOBJ_RES); return rc;