Changes: Christian Thalinger
Christian Ullrich
- $Id: descriptor.c 3380 2005-10-06 13:48:16Z edwin $
+ $Id: descriptor.c 3386 2005-10-07 14:02:52Z edwin $
*/
} else {
/* a field descriptor */
+
pool->fieldcount++;
if (!name_from_descriptor(pool->referer, utf_ptr, end_pos, NULL,
DESCRIPTOR_ASSERT(pool->descriptors);
DESCRIPTOR_ASSERT(pool->descriptors_next);
+ /* check that it is a method descriptor */
+
+ if (desc->text[0] != '(') {
+ *exceptionptr = new_classformaterror(pool->referer,
+ "Field descriptor used in method reference");
+ return NULL;
+ }
+
/* lookup the descriptor in the hashtable */
key = utf_hashkey(desc->text, desc->blength);
md = (methoddesc *) pool->descriptors_next;
pool->descriptors_next += sizeof(methoddesc) - sizeof(typedesc);
- utf_ptr = desc->text;
+ utf_ptr = desc->text + 1; /* skip '(' */
end_pos = UTF_END(desc);
- if (*utf_ptr++ != '(') {
- *exceptionptr = new_classformaterror(pool->referer,
- "Field descriptor used in method reference");
- return NULL;
- }
-
td = md->paramtypes;
/* count the `this' pointer */
Edwin Steiner
Christian Thalinger
- $Id: loader.c 3372 2005-10-06 13:10:24Z twisti $
+ $Id: loader.c 3386 2005-10-07 14:02:52Z edwin $
*/
if (!descriptor_pool_add(descpool, u, NULL))
return false;
+ /* descriptor_pool_add accepts method descriptors, so we have to check */
+ /* against them here before the call of desc_to_type below. */
+ if (u->text[0] == '(') {
+ *exceptionptr = new_classformaterror(c,"Method descriptor used for field");
+ return false;
+ }
+
if (opt_verify) {
/* check name */
if (!is_valid_name_utf(f->name) || f->name->text[0] == '<') {