From: Jay Freeman (saurik) Date: Fri, 10 Jan 2014 10:20:56 +0000 (-0800) Subject: If CydgetMemoryParse fails, it should return NULL. X-Git-Tag: v0.9.500~79 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/40cbf5103dfc6be0e1f05f4d84afb24138dcdd4a If CydgetMemoryParse fails, it should return NULL. --- diff --git a/Library.cpp b/Library.cpp index c64268c..f79711b 100644 --- a/Library.cpp +++ b/Library.cpp @@ -191,7 +191,7 @@ double CYCastDouble(const char *value) { return CYCastDouble(value, strlen(value)); } -extern "C" void CydgetMemoryParse(const uint16_t **data, size_t *size) { +extern "C" bool CydgetMemoryParse(const uint16_t **data, size_t *size) { CYLocalPool local; CYUTF8String utf8(CYPoolUTF8String(local, CYUTF16String(*data, *size))); @@ -199,8 +199,11 @@ extern "C" void CydgetMemoryParse(const uint16_t **data, size_t *size) { CYDriver driver(stream); cy::parser parser(driver); - if (parser.parse() != 0 || !driver.errors_.empty()) - return; + if (parser.parse() != 0 || !driver.errors_.empty()) { + *data = NULL; + *size = 0; + return false; + } CYOptions options; CYContext context(options); @@ -219,6 +222,7 @@ extern "C" void CydgetMemoryParse(const uint16_t **data, size_t *size) { *data = copy; *size = utf16.size; + return true; } CYPool &CYGetGlobalPool() {