8034926: Attribute classes properly

Thu, 20 Feb 2014 13:30:59 -0500

author
hseigel
date
Thu, 20 Feb 2014 13:30:59 -0500
changeset 6757
0964e6038231
parent 6756
1f59838e019d
child 6758
c28dffbb1d74

8034926: Attribute classes properly
Summary: Add check to prevent underflow
Reviewed-by: coleenp, ahgross

src/share/vm/classfile/classFileParser.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/classfile/classFileParser.cpp	Tue Feb 18 14:19:24 2014 -0800
     1.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Thu Feb 20 13:30:59 2014 -0500
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -2777,6 +2777,11 @@
    1.11                       "Short length on BootstrapMethods in class file %s",
    1.12                       CHECK);
    1.13  
    1.14 +  guarantee_property(attribute_byte_length > sizeof(u2),
    1.15 +                     "Invalid BootstrapMethods attribute length %u in class file %s",
    1.16 +                     attribute_byte_length,
    1.17 +                     CHECK);
    1.18 +
    1.19    // The attribute contains a counted array of counted tuples of shorts,
    1.20    // represending bootstrap specifiers:
    1.21    //    length*{bootstrap_method_index, argument_count*{argument_index}}

mercurial