< prev index next >
test/javax/sound/sampled/spi/AudioFileReader/ReadersExceptions.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -72,16 +72,61 @@
0, 33 // sampleSize
, 0, 0, 0, 0};
// empty channels
static byte[] wrongAUCh =
{0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
- 0, 0, 0, 0, // headerSize
+ 0, 0, 0, 24, // headerSize
0, 0, 0, 0, // dataSize
0, 0, 0, 1, // encoding_local AuFileFormat.AU_ULAW_8
- 0, 0, 0, 0, // sampleRate
+ 0, 0, 0, 1, // sampleRate
0, 0, 0, 0 // channels
};
+ // empty sample rate
+ static byte[] wrongAUSR =
+ {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+ 0, 0, 0, 24, // headerSize
+ 0, 0, 0, 0, // dataSize
+ 0, 0, 0, 1, // encoding_local AuFileFormat.AU_ULAW_8
+ 0, 0, 0, 0, // sampleRate
+ 0, 0, 0, 1 // channels
+ };
+ // empty header size
+ static byte[] wrongAUEmptyHeader =
+ {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+ 0, 0, 0, 0, // headerSize
+ 0, 0, 0, 0, // dataSize
+ 0, 0, 0, 1, // encoding_local AuFileFormat.AU_ULAW_8
+ 0, 0, 0, 1, // sampleRate
+ 0, 0, 0, 1 // channels
+ };
+ // small header size
+ static byte[] wrongAUSmallHeader =
+ {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+ 0, 0, 0, 7, // headerSize
+ 0, 0, 0, 0, // dataSize
+ 0, 0, 0, 1, // encoding_local AuFileFormat.AU_ULAW_8
+ 0, 0, 0, 1, // sampleRate
+ 0, 0, 0, 1 // channels
+ };
+ // frame size overflow, when result negative
+ static byte[] wrongAUFrameSizeOverflowNegativeResult =
+ {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+ 0, 0, 0, 24, // headerSize
+ 0, 0, 0, 0, // dataSize
+ 0, 0, 0, 5, // encoding_local AuFileFormat.AU_LINEAR_32
+ 0, 0, 0, 1, // sampleRate
+ 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF // channels
+ };
+ // frame size overflow, when result positive
+ static byte[] wrongAUFrameSizeOverflowPositiveResult =
+ {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+ 0, 0, 0, 24, // headerSize
+ 0, 0, 0, 0, // dataSize
+ 0, 0, 0, 4, // encoding_local AuFileFormat.AU_LINEAR_24
+ 0, 0, 0, 1, // sampleRate
+ 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF // channels
+ };
// empty channels
static byte[] wrongWAVCh =
{0x52, 0x49, 0x46, 0x46, // WaveFileFormat.RIFF_MAGIC
1, 1, 1, 1, // fileLength
0x57, 0x41, 0x56, 0x45, // waveMagic
@@ -111,12 +156,16 @@
0, 0, // sampleSizeInBits
0x64, 0x61, 0x74, 0x61, // WaveFileFormat.DATA_MAGIC
0, 0, 0, 0, // dataLength
};
- static byte[][] data = {wrongAIFFCh, wrongAIFFSSL, wrongAIFFSSH, wrongAUCh,
- wrongWAVCh, wrongWAVSSB};
+ static byte[][] data = {
+ wrongAIFFCh, wrongAIFFSSL, wrongAIFFSSH, wrongAUCh, wrongAUSR,
+ wrongAUEmptyHeader, wrongAUSmallHeader,
+ wrongAUFrameSizeOverflowNegativeResult,
+ wrongAUFrameSizeOverflowPositiveResult, wrongWAVCh, wrongWAVSSB
+ };
public static void main(final String[] args) throws IOException {
for (final byte[] bytes : data) {
testAS(bytes);
testAFR(bytes);
< prev index next >