From 4f5103f778278c2172f23791a42e9465a0c19c20 Mon Sep 17 00:00:00 2001 From: penguin2233 Date: Thu, 25 Jun 2026 21:30:34 +1000 Subject: [PATCH] fix crash on input not matching dictionary --- lib/sj4core/getcost.c | 4 +++- lib/sj4core/mkjiritu.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/sj4core/getcost.c b/lib/sj4core/getcost.c index f889ad8..9688c55 100644 --- a/lib/sj4core/getcost.c +++ b/lib/sj4core/getcost.c @@ -49,7 +49,9 @@ static void getcost_hira(SJ4_CONTEXT u_char* p, int* len) { int getcost(SJ4_CONTEXT u_char* p) { char flg = TRUE; int i; - int result; + int result = 0; + + if (!p) return result; do { if(p[codesize(*p)] == KANJISTREND) flg = FALSE; diff --git a/lib/sj4core/mkjiritu.c b/lib/sj4core/mkjiritu.c index e05be0a..dd32c7e 100644 --- a/lib/sj4core/mkjiritu.c +++ b/lib/sj4core/mkjiritu.c @@ -86,7 +86,7 @@ void mkjiritu(SJ4_CONTEXT int mode) { static void dic_mu(SJ4_CONTEXT int mode) { - u_char* tagp; + u_char* tagp = NULL; DICTL* dp; for(dp = dictlist; dp; dp = dp->next) {