Skip to content

Wrap possible AssertionError from Ion class #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,11 @@ public String getText() throws IOException
try {
// stringValue() will throw an UnknownSymbolException if we're
// trying to get the text for a symbol id that cannot be resolved.
// stringValue() has an assert statement which could throw an
// AssertionError if we're trying to get the text with a symbol
// id less than or equals to 0.
return _reader.stringValue();
} catch (UnknownSymbolException e) {
} catch (UnknownSymbolException | AssertionError e) {
throw _constructError(e.getMessage(), e);
}
case VALUE_NUMBER_INT:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.fasterxml.jackson.dataformat.ion.fuzz;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.dataformat.ion.*;

import java.io.IOException;

import org.junit.Assert;
import org.junit.Test;

@SuppressWarnings("resource")
public class Fuzz64721InvalidIonTest
{
@Test(expected = JsonParseException.class)
public void testFuzz64721AssertionException() throws IOException {
IonFactory f = IonFactory
.builderForBinaryWriters()
.enable(IonParser.Feature.USE_NATIVE_TYPE_ID)
.build();
IonObjectMapper mapper = IonObjectMapper.builder(f).build();
mapper.readValue("$0/", EnumFuzz.class);
}

private static enum EnumFuzz {
A, B, C, D, E;
}
}