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


##########
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:
   The check errors are basically the same.
   
   
![image](https://github.com/apache/apisix/assets/10219699/0ff1a397-d184-48e3-b296-d9350f6a1278)
   



-- 
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