Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
asm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
asm
asm
Commits
ba49829a
Commit
ba49829a
authored
Dec 17, 2017
by
Eric Bruneton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more tests with invalid classes and a synthetic class using the swap instruction.
parent
9933fac0
Pipeline
#471
passed with stage
in 10 minutes and 32 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
92 additions
and
5 deletions
+92
-5
asm-test/src/main/java/org/objectweb/asm/test/AsmTest.java
asm-test/src/main/java/org/objectweb/asm/test/AsmTest.java
+4
-1
asm-test/src/main/resources/invalid/InvalidConstantPoolReference.class
...main/resources/invalid/InvalidConstantPoolReference.class
+0
-0
asm-test/src/main/resources/invalid/InvalidWideOpcode.class
asm-test/src/main/resources/invalid/InvalidWideOpcode.class
+0
-0
asm-test/src/main/resources/jdk3/Swap.class
asm-test/src/main/resources/jdk3/Swap.class
+0
-0
asm-test/src/resources/java/invalid/InvalidConstantPoolReference.java
.../resources/java/invalid/InvalidConstantPoolReference.java
+30
-0
asm-test/src/resources/java/invalid/InvalidWideOpcode.java
asm-test/src/resources/java/invalid/InvalidWideOpcode.java
+36
-0
asm-test/src/test/java/org/objectweb/asm/test/AsmTestTest.java
...est/src/test/java/org/objectweb/asm/test/AsmTestTest.java
+2
-0
asm/src/main/java/org/objectweb/asm/ClassReader.java
asm/src/main/java/org/objectweb/asm/ClassReader.java
+19
-4
asm/src/test/java/org/objectweb/asm/ClassReaderTest.java
asm/src/test/java/org/objectweb/asm/ClassReaderTest.java
+1
-0
No files found.
asm-test/src/main/java/org/objectweb/asm/test/AsmTest.java
View file @
ba49829a
...
...
@@ -110,6 +110,7 @@ public abstract class AsmTest {
JDK3_INNER_CLASS
(
"jdk3.AllStructures$InnerClass"
),
JDK3_LARGE_METHOD
(
"jdk3.LargeMethod"
),
JDK3_STACK_MAP_ATTRIBUTE
(
"jdk3.StackMapAttribute"
),
JDK3_SWAP
(
"jdk3.Swap"
),
JDK5_ALL_INSTRUCTIONS
(
"jdk5.AllInstructions"
),
JDK5_ALL_STRUCTURES
(
"jdk5.AllStructures"
),
JDK5_ANNOTATION
(
"jdk5.AllStructures$InvisibleAnnotation"
),
...
...
@@ -190,13 +191,15 @@ public abstract class AsmTest {
INVALID_BYTECODE_OFFSET
(
"invalid.InvalidBytecodeOffset"
),
INVALID_CLASS_VERSION
(
"invalid.InvalidClassVersion"
),
INVALID_CONSTANT_POOL_INDEX
(
"invalid.InvalidConstantPoolIndex"
),
INVALID_CONSTANT_POOL_REFERENCE
(
"invalid.InvalidConstantPoolReference"
),
INVALID_CP_INFO_TAG
(
"invalid.InvalidCpInfoTag"
),
INVALID_ELEMENT_VALUE
(
"invalid.InvalidElementValue"
),
INVALID_INSN_TYPE_ANNOTATION_TARGET_TYPE
(
"invalid.InvalidInsnTypeAnnotationTargetType"
),
INVALID_OPCODE
(
"invalid.InvalidOpcode"
),
INVALID_STACK_MAP_FRAME_TYPE
(
"invalid.InvalidStackMapFrameType"
),
INVALID_TYPE_ANNOTATION_TARGET_TYPE
(
"invalid.InvalidTypeAnnotationTargetType"
),
INVALID_VERIFICATION_TYPE_INFO
(
"invalid.InvalidVerificationTypeInfo"
);
INVALID_VERIFICATION_TYPE_INFO
(
"invalid.InvalidVerificationTypeInfo"
),
INVALID_WIDE_OPCODE
(
"invalid.InvalidWideOpcode"
);
private
final
String
name
;
...
...
asm-test/src/main/resources/invalid/InvalidConstantPoolReference.class
0 → 100644
View file @
ba49829a
File added
asm-test/src/main/resources/invalid/InvalidWideOpcode.class
0 → 100644
View file @
ba49829a
File added
asm-test/src/main/resources/jdk3/Swap.class
0 → 100644
View file @
ba49829a
File added
asm-test/src/resources/java/invalid/InvalidConstantPoolReference.java
0 → 100644
View file @
ba49829a
// ASM: a very small and fast Java bytecode manipulation framework
// Copyright (c) 2000-2011 INRIA, France Telecom
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holders nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
package
invalid
;
public
class
InvalidConstantPoolReference
{}
asm-test/src/resources/java/invalid/InvalidWideOpcode.java
0 → 100644
View file @
ba49829a
// ASM: a very small and fast Java bytecode manipulation framework
// Copyright (c) 2000-2011 INRIA, France Telecom
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holders nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
package
invalid
;
public
class
InvalidWideOpcode
{
public
int
m
(
int
i
)
{
i
+=
1024
;
return
i
;
}
}
asm-test/src/test/java/org/objectweb/asm/test/AsmTestTest.java
View file @
ba49829a
...
...
@@ -108,6 +108,7 @@ public class AsmTestTest extends AsmTest {
case
JDK3_INNER_CLASS:
case
JDK3_LARGE_METHOD:
case
JDK3_STACK_MAP_ATTRIBUTE:
case
JDK3_SWAP:
case
JDK5_ALL_INSTRUCTIONS:
case
JDK5_ALL_STRUCTURES:
case
JDK5_ENUM:
...
...
@@ -152,6 +153,7 @@ public class AsmTestTest extends AsmTest {
case
JDK3_INNER_CLASS:
case
JDK3_LARGE_METHOD:
case
JDK3_STACK_MAP_ATTRIBUTE:
case
JDK3_SWAP:
case
JDK5_ALL_INSTRUCTIONS:
case
JDK5_ALL_STRUCTURES:
case
JDK5_ENUM:
...
...
asm/src/main/java/org/objectweb/asm/ClassReader.java
View file @
ba49829a
...
...
@@ -1454,10 +1454,25 @@ public class ClassReader {
currentOffset
+=
5
;
break
;
case
Constants
.
WIDE
:
if
((
classFileBuffer
[
currentOffset
+
1
]
&
0xFF
)
==
Opcodes
.
IINC
)
{
currentOffset
+=
6
;
}
else
{
currentOffset
+=
4
;
switch
(
classFileBuffer
[
currentOffset
+
1
]
&
0xFF
)
{
case
Constants
.
ILOAD
:
case
Constants
.
FLOAD
:
case
Constants
.
ALOAD
:
case
Constants
.
LLOAD
:
case
Constants
.
DLOAD
:
case
Constants
.
ISTORE
:
case
Constants
.
FSTORE
:
case
Constants
.
ASTORE
:
case
Constants
.
LSTORE
:
case
Constants
.
DSTORE
:
case
Constants
.
RET
:
currentOffset
+=
4
;
break
;
case
Constants
.
IINC
:
currentOffset
+=
6
;
break
;
default
:
throw
new
IllegalArgumentException
();
}
break
;
case
Constants
.
TABLESWITCH
:
...
...
asm/src/test/java/org/objectweb/asm/ClassReaderTest.java
View file @
ba49829a
...
...
@@ -307,6 +307,7 @@ public class ClassReaderTest extends AsmTest implements Opcodes {
}
else
{
ClassReader
classReader
=
new
ClassReader
(
invalidClass
.
getBytes
());
if
(
invalidClass
==
InvalidClass
.
INVALID_CONSTANT_POOL_INDEX
||
invalidClass
==
InvalidClass
.
INVALID_CONSTANT_POOL_REFERENCE
||
invalidClass
==
InvalidClass
.
INVALID_BYTECODE_OFFSET
)
{
assertThrows
(
ArrayIndexOutOfBoundsException
.
class
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment