sparklyupdog opened a new issue, #3673:
URL: https://github.com/apache/fory/issues/3673

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fory/issues) 
and found no similar issues.
   
   
   ### Version
   
   0.17.0
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
   Here's the code
   
   ```java
       public static record SomeDataU(long unboxedLong) {
       }
   
       public static record SomeDataB(Long boxedLong) {
       }
   
       public static void main(String... args) throws IOException {
           var fory = Fory.builder()
               .withLanguage(Language.JAVA)
               .requireClassRegistration(true)
               .build();
           fory.register(SomeDataU.class);
           fory.register(SomeDataB.class);
   
           // works fine
           fory.deserialize(fory.serialize(new SomeDataU(100L)));
           // throws an exception
           fory.deserialize(fory.serialize(new SomeDataB(100L)));
       }
   ```
   
   Deserialization of the second object always fails. If the object is simple 
like this, it would be IndexOutOfBoundsException, if it is big enough to resize 
underlying memory buffer, it will fail later because buffer reader position for 
some reason does not advance after reading Long field, which breaks all other 
fields.
   
   ### What did you expect to see?
   
   Deserialization does not throws an exception
   
   ### What did you see instead?
   
   best case is IndexOutOfBoundsException during deserialization, worst case is 
obscure errors around deserialized objects
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to