You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JavaBinarySerializer.writeExternal writes a property count that doesn't match the bytes written #4328
Affected version: 26.4.2 (confirmed still present in 26.5.1) Component:com.arcadedb.serializer.JavaBinarySerializer
Summary
The writer increments properties.size() as the property count at the start, then skips writing the size/payload bytes for properties where propValue == null or where the type cannot be inferred (type == -1). The reader iterates propertyCount times and reads UTF + int + bytes for each — so a single skipped property desyncs every subsequent read.
out.writeInt(properties.size()); // count includes every entryfor (Map.Entry<String, Object> prop : properties.entrySet()) {
out.writeUTF(propName); // always writtenif (propValue != null) {
…
if (type == -1) { log.warn(…); continue; } // size/payload NOT writtenout.writeInt(buffer.size());
out.write(buffer.getContent(), 0, buffer.size());
}
// null values: size/payload NOT written either
}
// readExternal:finalintpropertyCount = in.readInt();
for (inti = 0; i < propertyCount; i++) {
finalStringpropName = in.readUTF();
finalintpropertySize = in.readInt();
finalbyte[] array = newbyte[propertySize];
in.read(array); // see issue #10
…
}
Impact
Any document with a null-valued or un-serializable property deserializes into garbage (wrong property names mapped to wrong bytes) or throws somewhere downstream with an opaque message.
Suggested fix
Filter the map down to serializable, non-null properties; write the filtered count and only filtered entries.
Activity
fix(#4328): pre-serialize properties so count matches bytes written i…
fix(#4328): pre-serialize properties so count matches bytes written i…
fix(ArcadeData#4328): pre-serialize properties so count matches bytes…
fix(#4328): pre-serialize properties so count matches bytes written i…