branch: externals/hotfuzz
commit f91c0972cc8887f8e2a123feb96bb5120d2b77c3
Author: Axel Forsman <[email protected]>
Commit: Axel Forsman <[email protected]>

    Check copy_string_contents return value
    
    It can fail if the Lisp string cannot be UTF-8 encoded.
---
 hotfuzz-module.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hotfuzz-module.c b/hotfuzz-module.c
index 99a5efbb6c..e55af5e575 100644
--- a/hotfuzz-module.c
+++ b/hotfuzz-module.c
@@ -177,7 +177,8 @@ static void bump_free(struct Bump *head) {
 static struct EmacsStr *copy_emacs_string(emacs_env *env, struct Bump **bump, 
emacs_value value) {
        ptrdiff_t len;
        // Determine the size of the string (including null-terminator)
-       env->copy_string_contents(env, value, NULL, &len);
+       if (!env->copy_string_contents(env, value, NULL, &len))
+               return NULL;
 
        struct EmacsStr *result;
        // Note: Since only EmacsStr:s are allocated with bump_alloc we

Reply via email to