Check-in [274fc0cd3e]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the read padding byte to the error message.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:274fc0cd3e6af26103c21a54fbf401c5b856ea41
User & Date: stephanie.gawroriski 2019-04-17 16:36:49
Context
2019-04-17
16:48
Some corrections. check-in: aade498ed0 user: stephanie.gawroriski tags: trunk
16:36
Add the read padding byte to the error message. check-in: 274fc0cd3e user: stephanie.gawroriski tags: trunk
16:29
Add end of file magic number and check that on read. check-in: bf36d53942 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/mini/MinimizedPool.java.

129
130
131
132
133
134
135
136
137


138
139

140
141
142
143
144
145
146
		try (DataInputStream dis = new DataInputStream(
			new ByteArrayInputStream(__is, __o, __l)))
		{
			// Read type table
			dis.readFully(types);
			
			// {@squirreljme.error JC44 Pool uneven padding byte was not
			// 0xFF.}
			if ((__n & 1) != 0)


				if (dis.readUnsignedByte() != 0xFF)
					throw new InvalidClassFormatException("JC44");

			
			// Read offsets into the structure
			for (int i = 0; i < __n; i++)
				offsets[i] = dis.readUnsignedShort();
			
			// Debug
			for (int i = 0; i < __n; i++)







|

>
>
|
|
>







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
		try (DataInputStream dis = new DataInputStream(
			new ByteArrayInputStream(__is, __o, __l)))
		{
			// Read type table
			dis.readFully(types);
			
			// {@squirreljme.error JC44 Pool uneven padding byte was not
			// 255. (The value it was)}
			if ((__n & 1) != 0)
			{
				int val;
				if ((val = dis.readUnsignedByte()) != 0xFF)
					throw new InvalidClassFormatException("JC44 " + val);
			}
			
			// Read offsets into the structure
			for (int i = 0; i < __n; i++)
				offsets[i] = dis.readUnsignedShort();
			
			// Debug
			for (int i = 0; i < __n; i++)

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/mini/Minimizer.java.

148
149
150
151
152
153
154
155

156


157
158
159
160
161
162
163
		
		// Relative offset where all the data will end up being, starts at
		// the constant pool address. Size is calculated as:
		// written + pooloff/len + fieldoff/len + methodoff/len + fileoff/len
		int reloff = __dos.size() + 8 + 16 + 16 + 8,
			baserel = reloff;
		
		// Constant pool locator

		byte[] pooldata = pool.getBytes();


		__dos.writeInt(reloff);
		__dos.writeInt(pooldata.length);
		
		// Round
		reloff = Minimizer.__relAdd(reloff, pooldata.length);
		
		// Field locator







|
>

>
>







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
		
		// Relative offset where all the data will end up being, starts at
		// the constant pool address. Size is calculated as:
		// written + pooloff/len + fieldoff/len + methodoff/len + fileoff/len
		int reloff = __dos.size() + 8 + 16 + 16 + 8,
			baserel = reloff;
		
		// Base round to pool data
		reloff = Minimizer.__relAdd(reloff, 0);
		byte[] pooldata = pool.getBytes();
		
		// Constant pool locator
		__dos.writeInt(reloff);
		__dos.writeInt(pooldata.length);
		
		// Round
		reloff = Minimizer.__relAdd(reloff, pooldata.length);
		
		// Field locator