shithub: libmujs

Download patch

ref: eeea83a807beabb5106b762458c7fdf29970bd60
parent: bd79071a6f1ead71c9eb689e2ae97dcb9241657c
author: Tor Andersson <tor.andersson@artifex.com>
date: Tue Jun 11 06:26:28 EDT 2019

Issue 102: Workaround for address-sanitizer default realloc behavior.

--- a/jsstate.c
+++ b/jsstate.c
@@ -9,6 +9,14 @@
 
 static void *js_defaultalloc(void *actx, void *ptr, int size)
 {
+#if defined(__has_feature)
+#if __has_feature(address_sanitizer)
+	if (size == 0) {
+		free(ptr);
+		return NULL;
+	}
+#endif
+#endif
 	return realloc(ptr, (size_t)size);
 }