Add missing validity check in f_strflocaltime after f_localtime (#3491)

This commit is contained in:
itchyny authored and GitHub committed 2026-03-02 21:58:07 +09:00
1 parent c3d3e7d656
commit 262f0b81c1
1 file changed
+4
+4
View File
@@ -1803,6 +1803,10 @@ static jv f_strftime(jq_state *jq, jv a, jv b) {
static jv f_strflocaltime(jq_state *jq, jv a, jv b) {
if (jv_get_kind(a) == JV_KIND_NUMBER) {
a = f_localtime(jq, a);
if (!jv_is_valid(a)) {
jv_free(b);
return a;
}
} else if (jv_get_kind(a) != JV_KIND_ARRAY) {
return ret_error2(a, b, jv_string("strflocaltime/1 requires parsed datetime inputs"));
}