Skip to content

Commit 896abf0

Browse files
committed
csv: remove old workaround in UTF8Reader
1 parent d43289d commit 896abf0

File tree

3 files changed

+2
-18
lines changed

3 files changed

+2
-18
lines changed

csv/src/main/java/com/fasterxml/jackson/dataformat/csv/impl/UTF8Reader.java

-13
Original file line numberDiff line numberDiff line change
@@ -403,19 +403,6 @@ private boolean loadMore(int available) throws IOException
403403
// Bytes that need to be moved to the beginning of buffer?
404404
if (available > 0) {
405405
if (_inputPtr > 0) {
406-
if (!canModifyBuffer()) {
407-
// 15-Aug-2022, tatu: Occurs (only) if we have half-decoded UTF-8
408-
// characters; uncovered by:
409-
//
410-
// https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50036
411-
//
412-
// and need to be reported as IOException
413-
if (_inputSource == null) {
414-
throw new IOException(String.format(
415-
"End-of-input after first %d byte(s) of a UTF-8 character: needed at least one more",
416-
available));
417-
}
418-
}
419406
for (int i = 0; i < available; ++i) {
420407
_inputBuffer[i] = _inputBuffer[_inputPtr+i];
421408
}

csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/FuzzCSVReadTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public void testUTF8Decoding50036() throws Exception
2525
CSV_MAPPER.readTree(INPUT);
2626
fail("Should not pass");
2727
} catch (IOException e) {
28-
verifyException(e, "End-of-input after first 1 byte");
29-
verifyException(e, "of a UTF-8 character");
28+
verifyException(e, "Unexpected EOF in the middle of a multi-byte UTF-8 character");
3029
}
3130
}
3231

csv/src/test/java/com/fasterxml/jackson/dataformat/csv/tofix/UnicodeCSVRead497Test.java renamed to csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/UnicodeCSVRead497Test.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fasterxml.jackson.dataformat.csv.tofix;
1+
package com.fasterxml.jackson.dataformat.csv.deser;
22

33
import java.io.ByteArrayInputStream;
44
import java.nio.charset.StandardCharsets;
@@ -8,7 +8,6 @@
88
import com.fasterxml.jackson.databind.JsonNode;
99
import com.fasterxml.jackson.dataformat.csv.CsvMapper;
1010
import com.fasterxml.jackson.dataformat.csv.ModuleTestBase;
11-
import com.fasterxml.jackson.dataformat.csv.testutil.failure.JacksonTestFailureExpected;
1211

1312
import static org.junit.jupiter.api.Assertions.*;
1413

@@ -18,7 +17,6 @@ public class UnicodeCSVRead497Test extends ModuleTestBase
1817
private final CsvMapper MAPPER = mapperForCsv();
1918

2019
// [dataformats-text#497]
21-
@JacksonTestFailureExpected
2220
@Test
2321
public void testUnicodeAtEnd() throws Exception
2422
{

0 commit comments

Comments
 (0)