0

The protobuf-file has the following declaration of method:

message GetRequest {
   int64 client_id = 1;
   google.protobuf.StringValue name = 2;
 }

It generate:

final case class GetRequest(
    clientId: _root_.scala.Long = 0L,
    name: scala.Option[_root_.scala.Predef.String] = None
)

I invoke method with different values of clientId and observe the behavior by Idea-debug.

As a result:

  • Some values of clientId, for example 816645943620556288, passed successfully.

  • But some another passed with strange transformation. For example, for 12550491997690948864 last digits transforms to 912 (from 864). So in fact method receive non correct argument: 12550491997690948912. One more example 1267049198769094768 to 1267049198769094656

I suspect, some bytes shuffled or missed at the tail of passed value (while int64 transformed to Long).

But I'm not sure.

Jelly
  • 972
  • 1
  • 17
  • 40
  • Please revise your post title to ask a clear, _specific_ question. Don't add tags. See [ask]. – isherwood Jun 22 '22 at 12:52
  • Including an hex dump of the encoded messages could help. You can then check them with e.g. https://protobuf-decoder.netlify.app/ to see if it is correct. I suspect some corruption is happening to the data after it has been encoded, typical reason would be passing it as text string instead of binary data. – jpa Jun 23 '22 at 05:56

0 Answers0