zhoujiexiong commented on code in PR #11367:
URL: https://github.com/apache/apisix/pull/11367#discussion_r1663822694


##########
t/plugin/grpc-transcode3.t:
##########
@@ -525,3 +525,44 @@ location /t {
         end
     }
 }
+
+
+
+=== TEST 13: bugfix - filter out illegal INT(string) formats
+--- config
+location /t {
+    content_by_lua_block {
+        local pb = require "pb"
+        local pb_encode = pb.encode
+        local protoc = require "protoc"
+        local pcall = pcall
+
+        assert(protoc:load [[
+        syntax = "proto3";
+        message IntStringPatterns {
+          repeated int64 values = 1;
+        }]])
+
+        local supported = {
+            values = {
+                1, 2, -3, "#123", "0xabF", "#-0x123abcdef", "-#0x123abcdef", 
"#0x123abc", "123",
+            },
+        }
+
+        local unsupported = {
+            values = {
+                "#a", "+aaa", "#aaaaa", "#-aa",
+            },
+        }
+
+        --pb.option "int64_as_string"
+        --pb.option "int64_as_hexstring"
+        pb_encode("IntStringPatterns", supported)
+        local status, err = pcall(pb_encode, "IntStringPatterns", unsupported)

Review Comment:
   @shreemaan-abhishek test case updated, pls. re-check.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to