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

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fory/issues) 
and found no similar issues.
   
   
   ### Version
   
   Fory 0.13.1
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
   I used 0.12.2 fory to serialize an UUID object, belows are the code snippets:
   ```
   final Fory fory = Fory.builder()
           .withLanguage(Language.JAVA)
           .requireClassRegistration(false)
           .build();
   
   final UUID uuid = 
UUID.fromString("45985b2a-87ba-4747-b5d6-21ab[45666596](tel:45666596)");
   final byte[] bytes = fory.serialize(uuid);
   
   
   final String filePath = "~/data.fory.uuid.0.12.2";
   try (FileOutputStream fos = new FileOutputStream(filePath)) {
       fos.write(bytes);
   }
   ```
   
   Then I used 0.13.1 fory to deserialize, belows are the code snippets:
   ```
   final Fory fory = Fory.builder()
           .withLanguage(Language.JAVA)
           .requireClassRegistration(false)
           .build();
   final String filePath = "~/data.fory.uuid.0.12.2";
   final byte[] readBytes = Files.readAllBytes(Path.of(filePath));
   
   final UUID restored = fory.deserialize(readBytes, UUID.class);
   ```
   
   The deserializing codes report the exception:
   Exception in thread "main" 
org.apache.fory.exception.DeserializationException: Failed to deserialize input
           at 
org.apache.fory.util.ExceptionUtils.handleReadFailed(ExceptionUtils.java:66)
           at org.apache.fory.Fory.deserialize(Fory.java:892)
           at org.apache.fory.Fory.deserialize(Fory.java:805)
           at 
com.ruijie.rcos.dex.explorer.serializer.ForyFileExample.deserialize(ForyFileExample.java:80)
           at 
com.ruijie.rcos.dex.explorer.serializer.ForyFileExample.main(ForyFileExample.java:28)
   Caused by: java.lang.IndexOutOfBoundsException: readerIndex(5) + length(2) 
exceeds size(20): org.apache.fory.memory.MemoryBuffer$BoundChecker@1750fbeb
           at 
org.apache.fory.memory.MemoryBuffer$BoundChecker.fillBuffer(MemoryBuffer.java:189)
           at 
org.apache.fory.memory.MemoryBuffer.checkReadableBytes(MemoryBuffer.java:2433)
           at 
org.apache.fory.serializer.StringSerializer.readBytesUnCompressedUTF16(StringSerializer.java:495)
           at 
org.apache.fory.serializer.StringSerializer.readBytesString(StringSerializer.java:199)
           at 
org.apache.fory.serializer.StringSerializer.readJavaString(StringSerializer.java:349)
           at org.apache.fory.Fory.readJavaString(Fory.java:774)
           at 
org.apache.fory.serializer.Serializers$RegexSerializer.read(Serializers.java:528)
           at 
org.apache.fory.serializer.Serializers$RegexSerializer.read(Serializers.java:515)
           at org.apache.fory.Fory.readDataInternal(Fory.java:1049)
           at org.apache.fory.Fory.readRef(Fory.java:934)
           at org.apache.fory.Fory.deserialize(Fory.java:888)
           ... 3 more
   
   I used 0.12.2 Fory and 0.13.1 Fory to serialize the same UUID string, there 
is one difference (ac vs ae) in the hexdump files.
   
   <img width="886" height="160" alt="Image" 
src="https://github.com/user-attachments/assets/8ecdb3ea-2fb8-4883-b71c-9e2076247882";
 />
   
   ### What did you expect to see?
   
   Serialize and deserialize between the old and new versions of Fory Should be 
compatible.
   
   ### What did you see instead?
   
    Serialize and deserialize between the old and new versions of Fory are 
incompatible.
   
   ### 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