ion-tests icon indicating copy to clipboard operation
ion-tests copied to clipboard

Add bad tests for -0 integers

Open jonwilsdon opened this issue 5 years ago • 2 comments

Initially mentioned in https://github.com/amzn/ion-tests/pull/57#discussion_r362974284.

Value zero with type code 3 is illegal no matter how it's encoded.

It would be good to add bad tests for

E0 01 00 EA 31 00
E0 01 00 EA 32 00
...
E0 01 00 EA 3E 81 00

jonwilsdon avatar Jan 03 '20 23:01 jonwilsdon

Per the binary specification every representation of 0 other than 0x20 is invalid.

If the value is zero then T must be 2, L is zero, and there are no length or magnitude subfields.

Resolving this issue should likely include adding bad tests for invalid positive representations of 0 as well.

E0 01 00 EA 21 00
...

PeytonT avatar Jan 27 '20 02:01 PeytonT

We need to clarify the spec. Overpadded zero values on type code 2 (e.g. 21 00) should be allowed. I've created https://github.com/amzn/ion-docs/issues/93.

tgregg avatar Jan 27 '20 21:01 tgregg