]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llava-cli : don't crash if --image flag is invalid (#4835)
authorJustine Tunney <redacted>
Tue, 9 Jan 2024 17:59:14 +0000 (09:59 -0800)
committerGitHub <redacted>
Tue, 9 Jan 2024 17:59:14 +0000 (19:59 +0200)
This change fixes an issue where supplying `--image missing-file` would
result in a segfault due to a null pointer being dereferenced. This can
result in distracting info being printed if robust crash analysis tools
are being used.

examples/llava/llava-cli.cpp

index 502b788b14aba2f70e51348c86d2eb28105aff1a..d94795fe317d478efa8582365281e01b4ace6668 100644 (file)
@@ -243,6 +243,9 @@ int main(int argc, char ** argv) {
     }
 
     auto image_embed = load_image(ctx_llava, &params);
+    if (!image_embed) {
+        return 1;
+    }
 
     // process the prompt
     process_prompt(ctx_llava, image_embed, &params, params.prompt);