1818import io .opentdf .platform .sdk .TDF .Reader ;
1919
2020public class Fuzzing {
21- private static final String testDuration = "600s" ;
22- private static final OutputStream ignoreOutputStream = new OutputStream () {
21+ private static final String TEST_DURATION = "600s" ;
22+ private static final OutputStream IGNORE_OUTPUT_STREAM = new OutputStream () {
2323 @ Override
2424 public void write (int b ) {
2525 // ignored
2626 }
2727
2828 @ Override
29- public void write (byte b [] , int off , int len ) {
29+ public void write (byte [] b , int off , int len ) {
3030 // ignored
3131 }
3232 };
3333
34- @ FuzzTest (maxDuration =testDuration )
34+ @ FuzzTest (maxDuration =TEST_DURATION )
3535 public void fuzzNanoTDF (FuzzedDataProvider data ) throws IOException {
3636 byte [] fuzzBytes = data .consumeRemainingAsBytes ();
3737 NanoTDF nanoTDF = new NanoTDF ();
38- nanoTDF .readNanoTDF (ByteBuffer .wrap (fuzzBytes ), ignoreOutputStream , NanoTDFTest .kas );
38+ nanoTDF .readNanoTDF (ByteBuffer .wrap (fuzzBytes ), IGNORE_OUTPUT_STREAM , NanoTDFTest .kas );
3939 }
4040
41- @ FuzzTest (maxDuration =testDuration )
41+ @ FuzzTest (maxDuration =TEST_DURATION )
4242 public void fuzzTDF (FuzzedDataProvider data ) throws FailedToCreateGMAC , NoSuchAlgorithmException , IOException , JOSEException , ParseException , DecoderException {
4343 byte [] fuzzBytes = data .consumeRemainingAsBytes ();
4444 byte [] key = new byte [32 ]; // use consistent zero key for performance and so fuzz can relate to seed
@@ -51,13 +51,13 @@ public void fuzzTDF(FuzzedDataProvider data) throws FailedToCreateGMAC, NoSuchAl
5151 try {
5252 Reader reader = tdf .loadTDF (new SeekableInMemoryByteChannel (fuzzBytes ), TDFTest .kas , readerConfig );
5353
54- reader .readPayload (ignoreOutputStream );
54+ reader .readPayload (IGNORE_OUTPUT_STREAM );
5555 } catch (SDKException | InvalidZipException | JsonParseException | IOException | IllegalArgumentException e ) {
5656 // expected failure cases
5757 }
5858 }
5959
60- @ FuzzTest (maxDuration =testDuration )
60+ @ FuzzTest (maxDuration =TEST_DURATION )
6161 public void fuzzZipRead (FuzzedDataProvider data ) {
6262 byte [] fuzzBytes = data .consumeRemainingAsBytes ();
6363 try {
0 commit comments