@@ -291,14 +291,9 @@ public String getText() throws IOException
291
291
// Some special cases here:
292
292
case VALUE_EMBEDDED_OBJECT :
293
293
if (_reader .getType () == IonType .TIMESTAMP ) {
294
- try {
295
- Timestamp ts = _reader .timestampValue ();
296
- if (ts != null ) {
297
- return ts .toString ();
298
- }
299
- } catch (ArrayIndexOutOfBoundsException | NullPointerException e ) {
300
- // 07-Jan-2024, tatu: OSS-Fuzz#65628 points to AIOOBE:
301
- return _reportCorruptContent (e );
294
+ Timestamp ts = _timestampFromIonReader ();
295
+ if (ts != null ) {
296
+ return ts .toString ();
302
297
}
303
298
}
304
299
// How about CLOB?
@@ -549,7 +544,7 @@ public byte[] getBinaryValue(Base64Variant arg0) throws IOException
549
544
switch (_reader .getType ()) {
550
545
case BLOB :
551
546
case CLOB : // looks like CLOBs are much like BLOBs...
552
- return _reader . newBytes ();
547
+ return _bytesFromIonReader ();
553
548
default :
554
549
}
555
550
}
@@ -577,30 +572,43 @@ public Object getEmbeddedObject() throws IOException {
577
572
if (_currToken == JsonToken .VALUE_EMBEDDED_OBJECT ) {
578
573
switch (_reader .getType ()) {
579
574
case TIMESTAMP :
580
- try {
581
- return _reader .timestampValue ();
582
- } catch (ArrayIndexOutOfBoundsException | NullPointerException e ) {
583
- return _reportCorruptContent (e );
584
- } catch (IllegalArgumentException e ) {
585
- throw _constructError (String .format (
586
- "Invalid embedded TIMESTAMP value, problem: %s" , e .getMessage ()),
587
- e );
588
- }
575
+ return _timestampFromIonReader ();
589
576
case BLOB :
590
577
case CLOB :
591
- try {
592
- return _reader .newBytes ();
593
- } catch (NullPointerException e ) {
594
- // 02-Jan-2024, tatu: OSS-Fuzz#65479 points to NPE ^^^
595
- return _reportCorruptContent (e );
596
- }
578
+ return _bytesFromIonReader ();
597
579
// What about CLOB?
598
580
default :
599
581
}
600
582
}
601
583
return getIonValue ();
602
584
}
603
585
586
+ // @since 2.17
587
+ private byte [] _bytesFromIonReader () throws IOException {
588
+ try {
589
+ return _reader .newBytes ();
590
+ } catch (NullPointerException
591
+ // 02-Jan-2024, tatu: OSS-Fuzz#65479 points to NPE ^^^
592
+ | NegativeArraySizeException e ) {
593
+ // 23-Jan-2024, tatu: OSS-Fuzz#66077 points to NASE ^^^
594
+ return _reportCorruptContent (e );
595
+ }
596
+ }
597
+
598
+ // @since 2.17
599
+ private Timestamp _timestampFromIonReader () throws IOException {
600
+ try {
601
+ return _reader .timestampValue ();
602
+ } catch (ArrayIndexOutOfBoundsException | NullPointerException e ) {
603
+ // 07-Jan-2024, tatu: OSS-Fuzz#65628 points to AIOOBE:
604
+ return _reportCorruptContent (e );
605
+ } catch (IllegalArgumentException e ) {
606
+ throw _constructError (String .format (
607
+ "Invalid embedded TIMESTAMP value, problem: %s" , e .getMessage ()),
608
+ e );
609
+ }
610
+ }
611
+
604
612
/*
605
613
/**********************************************************
606
614
/* Public API, Native Ids (type, object)
0 commit comments