00sense opened a new issue, #3783:
URL: https://github.com/apache/fory/issues/3783

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fory/issues) 
and found no similar issues.
   
   
   ### Version
   
   Fory 1.2.0, Java 23.
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
     Fory 1.2.0, Java 23.
   
     Fory fory = Fory.builder()
         .withLanguage(Language.JAVA)
         .withRefTracking(false)
         .withCompatibleMode(CompatibleMode.SCHEMA_CONSISTENT)
         .requireClassRegistration(false)
         .build();
     LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<>();
     queue.add("a");
     queue.add("b");
     byte[] bytes = fory.serialize(queue);
     fory.deserialize(bytes);
   
     Same thing with a bounded queue works:
   
     LinkedBlockingQueue<String> bounded = new LinkedBlockingQueue<>(16);
     bounded.add("a");
     fory.deserialize(fory.serialize(bounded)); // fine
   
   ### What did you expect to see?
   
   serialize + deserialize round-trip should work for a default new 
LinkedBlockingQueue<>(), same as other collection types (ArrayDeque, ArrayList, 
etc.).
   
   ### What did you see instead?
   
   Serialize succeeds. Deserialize throws:
   
     org.apache.fory.exception.DeserializationException: Failed to deserialize 
input
     Caused by: java.lang.IndexOutOfBoundsException: readerIndex(9) + 
length(2147483532) exceeds size(124)
         at 
org.apache.fory.serializer.collection.CollectionSerializers$LinkedBlockingQueueSerializer.newCollection(CollectionSerializers.java:997)
   
   My guess: newCollection reads capacity off the wire and passes it to 
checkReadableBytes(capacity). For an unbounded queue that capacity is 
~Integer.MAX_VALUE, so it blows up. Bounded new LinkedBlockingQueue<>(16) 
doesn't hit this.
   
   ### 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