summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEmanuele Torre <torreemanuele6@gmail.com>2024-03-15 14:30:23 +0100
committerGitHub <noreply@github.com>2024-03-15 14:30:23 +0100
commit1411ce63d5314ad8771d2bae01d0a4144b30049c (patch)
treea362b34c69244ec353033e45ca05c1ed763d8339 /tests
parent6f67bae60b7d5d1d34438f78acc12266b6dc1f0c (diff)
strftime/1: fix validation of non-string argument with number input
There was a incorrect else, that caused jq to not ensure that the argument to strftime/1 is a string when the input is a number; this ends up calling jv_string_value on a non-string value, which does not work, and causes an assert failure. Also fix same bug in strflocaltime/1. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=67403
Diffstat (limited to 'tests')
-rw-r--r--tests/jq.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/jq.test b/tests/jq.test
index c8436f64..463161c7 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -1585,6 +1585,15 @@ try mktime catch .
["a",1,2,3,4,5,6,7]
"mktime requires parsed datetime inputs"
+# oss-fuzz #67403: non-string argument with number input fails assert
+try ["OK", strftime([])] catch ["KO", .]
+0
+["KO","strftime/1 requires a string format"]
+
+try ["OK", strflocaltime({})] catch ["KO", .]
+0
+["KO","strflocaltime/1 requires a string format"]
+
# module system
import "a" as foo; import "b" as bar; def fooa: foo::a; [fooa, bar::a, bar::b, foo::a]
null