Adds bad type descriptors and README #57
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
Adds bad files for each invalid TL pair and a README that describes the files. This came out of the interest shown in #56. Each invalid TL pair is in its own file.
Below are the issues that I noticed when testing it with the various language implementations:
ion-c
0x1_
) givesIERR_INVALID_STATE
instead ofIERR_INVALID_BINARY
0x60
) passes and produces0000T
instead of failing withIERR_INVALID_BINARY
0xE_
) givesIERR_UNEXPECTED_EOF
instead ofIERR_INVALID_BINARY
0xF_
) givesIERR_INVALID_STATE
instead ofIERR_INVALID_BINARY
ion-python
0x61
) fails withTypeError: ord() expected a character, but string of length 0 found
instead ofamazon.ion.exceptions.IonException: Invalid type octet: 0x61
ion-java
0x1E
) fails withException in thread "main" com.amazon.ion.IonException: unrecognized value type encountered: 15 at position 7
instead ofException in thread "main" com.amazon.ion.IonException: invalid length nibble in boolean value: 14 at position 5
0x60
) passes and producesnull.timestamp
instead of failing0x61
) fails withException in thread "main" com.amazon.ion.IonException: unexpected EOF in value at position 6
instead ofException in thread "main" com.amazon.ion.IonException: invalid length nibble in boolean value: 1 at position 5
0xE_
) fails withException in thread "main" com.amazon.ion.IonException: unexpected EOF in value at position 6
instead ofException in thread "main" com.amazon.ion.IonException: invalid length nibble in boolean value: [1,2] at position 5
0xEF
) fails withException in thread "main" com.amazon.ion.IonException: invalid binary image at position 5
instead ofException in thread "main" com.amazon.ion.IonException: invalid length nibble in boolean value: 15 at position 5
ion-js
0x1_
) does not error. Producesundefined
when callingreader.value()
, except for T1LE (0x1E
) which producestrue
. Note: I also noticed thatreader.booleanValue()
is able to be called on any value below0x10
(it returnsnull
on non-boolean values). For values above0x1F
it producesError: Current value is not a Boolean.
(Edit: Binary reader booleanValue can be called on type code 0 elements ion-js#537)0x30
) producesl [ sign: false ]
(which is the same output as0x31 00
) instead of failing.0x4E
) reads the VarUInt and will make a float if possible. Example:0x4E 81
errors withError: Illegal float length: 1
while0x4E 84 00 00 00 05
produces7.006492321624085e-45
0x60
) producesnull
instead of failing.0xE_
) producesError: Skipped over end of source.
instead of failing because of the type descriptor.0xF_
) does not error. Calls toreader.value()
produceError: There is no current value.
instead of failing.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.