Closed Arthurm1 closed 1 day ago
Since upgrading to 1.79 I get a literal data truncated in header exception when reading LiteralDataPacket.
literal data truncated in header
LiteralDataPacket
I'm not sure but I think this might be down to the changes in reading the modification time.
Before 1.79 the code was...
(((long)in.read() << 24) | (in.read() << 16) | (in.read() << 8) | in.read()) * 1000L
which would cope with a maximum date of new Date(Long.MAX_VALUE) // Sun Aug 17 07:12:55 GMT 292278994
new Date(Long.MAX_VALUE) // Sun Aug 17 07:12:55 GMT 292278994
Now it is...
(long) ((in.read() << 24) | (in.read() << 16) | (in.read() << 8) | in.read()) * 1000L
which would cope with a maximum date of new Date(Integer.MAX_VALUE * 1000L) // Tue Jan 19 03:14:07 GMT 2038
new Date(Integer.MAX_VALUE * 1000L) // Tue Jan 19 03:14:07 GMT 2038
I was using random data 1 Jan 2074 for testing and hit this as a negative date throws the exception.
1 Jan 2074
Fixed in https://github.com/bcgit/bc-java/commit/8902307a09adc76195d7e3985a4d22660bd102c5
Since upgrading to 1.79 I get a
literal data truncated in header
exception when readingLiteralDataPacket
.I'm not sure but I think this might be down to the changes in reading the modification time.
Before 1.79 the code was...
(((long)in.read() << 24) | (in.read() << 16) | (in.read() << 8) | in.read()) * 1000L
which would cope with a maximum date of
new Date(Long.MAX_VALUE) // Sun Aug 17 07:12:55 GMT 292278994
Now it is...
(long) ((in.read() << 24) | (in.read() << 16) | (in.read() << 8) | in.read()) * 1000L
which would cope with a maximum date of
new Date(Integer.MAX_VALUE * 1000L) // Tue Jan 19 03:14:07 GMT 2038
I was using random data
1 Jan 2074
for testing and hit this as a negative date throws the exception.