From 45a87e33e5386fc140255e26b0def22605c95e76 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 7 May 2022 12:29:35 +0800 Subject: [PATCH] Added test for #172 --- package.xml | 1 + tests/issue172.phpt | 54 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 tests/issue172.phpt diff --git a/package.xml b/package.xml index 81aa229..e2bf70f 100644 --- a/package.xml +++ b/package.xml @@ -113,6 +113,7 @@ + diff --git a/tests/issue172.phpt b/tests/issue172.phpt new file mode 100644 index 0000000..f2912ac --- /dev/null +++ b/tests/issue172.phpt @@ -0,0 +1,54 @@ +--TEST-- +ISSUE #172 $provider/$token may not be nullbyte-terminated +--SKIPIF-- + +--FILE-- +handle(); +PHP +); + +$token = str_pad("", 32, chr(127)); +for ($seq = 0; $seq < 32; $seq++) { + $ticket = $token; + $ticket[$seq] = "\0"; + Yar_Concurrent_Client::call(YAR_API_ADDRESS, "info", + NULL, NULL, NULL, + array( + YAR_OPT_PROVIDER=>"$seq", + YAR_OPT_TOKEN=>$ticket, + )); +} + +Yar_Concurrent_Client::loop(function($return, $callinfo) { +}, function($type, $error, $callinfo) { + echo $error; + +}); +?> +--CLEAN-- + +--EXPECT--