aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2016-02-11 13:59:51 -0800
committerAndy Clement <aclement@pivotal.io>2016-02-11 13:59:51 -0800
commita17b28a1a9a0756cfc2181bf2b095650e186425a (patch)
tree5972c7d51d269d2362c11bec63370235ed6c17e9 /bcel-builder
parentb54540d9a4843a46d6c2a25f6d2e7470648ef7c7 (diff)
downloadaspectj-a17b28a1a9a0756cfc2181bf2b095650e186425a.tar.gz
aspectj-a17b28a1a9a0756cfc2181bf2b095650e186425a.zip
Fix 487694: Race condition in annotation unpacking can surface through Spring AOP
Diffstat (limited to 'bcel-builder')
-rw-r--r--bcel-builder/bcel-verifier.jarbin161556 -> 0 bytes
-rw-r--r--bcel-builder/bcel.jarbin285242 -> 0 bytes
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java9
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java20
4 files changed, 21 insertions, 8 deletions
diff --git a/bcel-builder/bcel-verifier.jar b/bcel-builder/bcel-verifier.jar
deleted file mode 100644
index e6edce128..000000000
--- a/bcel-builder/bcel-verifier.jar
+++ /dev/null
Binary files differ
diff --git a/bcel-builder/bcel.jar b/bcel-builder/bcel.jar
deleted file mode 100644
index a7003b981..000000000
--- a/bcel-builder/bcel.jar
+++ /dev/null
Binary files differ
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java
index 05c83a6ee..c69b447ca 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java
@@ -71,12 +71,17 @@ public abstract class RuntimeAnnos extends Attribute {
}
}
+
private void inflate() {
try {
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(annotation_data));
int numberOfAnnotations = dis.readUnsignedShort();
- for (int i = 0; i < numberOfAnnotations; i++) {
- annotations.add(AnnotationGen.read(dis, getConstantPool(), visible));
+ if (numberOfAnnotations > 0) {
+ List<AnnotationGen> inflatedAnnotations = new ArrayList<AnnotationGen>();
+ for (int i = 0; i < numberOfAnnotations; i++) {
+ inflatedAnnotations.add(AnnotationGen.read(dis, getConstantPool(), visible));
+ }
+ annotations = inflatedAnnotations;
}
dis.close();
inflated = true;
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java
index ad92c9fce..650bd2625 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java
@@ -87,13 +87,21 @@ public abstract class RuntimeParamAnnos extends Attribute {
try {
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(annotation_data));
int numParameters = dis.readUnsignedByte();
- for (int i=0; i<numParameters; i++) {
- int numAnnotations = dis.readUnsignedShort();
- AnnotationGen[] annotations = new AnnotationGen[numAnnotations];
- for (int j=0; j<numAnnotations; j++) {
- annotations[j] = AnnotationGen.read(dis,getConstantPool(),visible);
+ if (numParameters > 0) {
+ List<AnnotationGen[]> inflatedParameterAnnotations = new ArrayList<AnnotationGen[]>();
+ for (int i=0; i<numParameters; i++) {
+ int numAnnotations = dis.readUnsignedShort();
+ if (numAnnotations == 0 ) {
+ inflatedParameterAnnotations.add(AnnotationGen.NO_ANNOTATIONS);
+ } else {
+ AnnotationGen[] annotations = new AnnotationGen[numAnnotations];
+ for (int j=0; j<numAnnotations; j++) {
+ annotations[j] = AnnotationGen.read(dis,getConstantPool(),visible);
+ }
+ inflatedParameterAnnotations.add(annotations);
+ }
}
- parameterAnnotations.add(annotations);
+ parameterAnnotations = inflatedParameterAnnotations;
}
inflated = true;
} catch (IOException ioe) {