# Re: size limits

Marianne Mueller (Marianne.Mueller@eng.sun.com)
Fri, 16 Apr 1999 11:12:21 -0700 (PDT)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Jan Luehe: "Re: JSECURITY Issue: Bad Link"
- Previous message: Sanjay Agara: "SSL Support in Java 1.2 Plugin"
- Maybe in reply to: colinw: "size limits"

    Message-Id: <199904161812.LAA06732@shorter.eng.sun.com>

    Date: Fri, 16 Apr 1999 11:12:21 -0700 (PDT)

    From: Marianne Mueller <Marianne.Mueller@eng.sun.com>

    Subject: Re: size limits

    To: java-security@java.sun.com, colinw@mis.net

The limit is 64K on an object and there's no way around it - can you restructure
the method so that it is composed of several smaller methods?

The limit was imposed to fix a potential security problem (an overflow).

The JDK classic VM uses a 16-bit integer to represent the number of
bytes in an object. Because a Java object may contain up to 64K
instance fields, each taking several bytes, the 16-bit integer may
overflow. An overflow object size may cause references to one field
in an object to be redirected by the VM to another field in the same
object. This could lead to a violation of the Java specification if
the former field is public and the latter is private.

The fix is to limit the size of objects to 64K bytes. This is an
implementation limitation of the classic VM. The Java VM
specification allows objects to contain up to 64K fields, each taking
up to 8 bytes, and thus objects may take at most 256K bytes.

This is dealt with in the runtime file classresolver.c.

Marianne

- Next message: Jan Luehe: "Re: JSECURITY Issue: Bad Link"
- Previous message: Sanjay Agara: "SSL Support in Java 1.2 Plugin"
- Maybe in reply to: colinw: "size limits"