ObjFW  Check-in [35257251ec]

Overview
Comment:OFLHAArchive: Ignore trailing garbage
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 35257251eceeb7001c66360d656616afb3d377da860df9e0fb83c406746a578e
User & Date: js on 2024-02-24 17:24:54
Other Links: manifest | tags
Context
2024-02-24
17:27
OFLHAArchive: Add support for -pm0- files check-in: f588271db7 user: js tags: trunk
17:25
OFLHAArchive: Ignore trailing garbage check-in: 927d1693c6 user: js tags: 1.0
17:24
OFLHAArchive: Ignore trailing garbage check-in: 35257251ec user: js tags: trunk
16:17
OFLHAArchive: Add support for -lz4- files check-in: 42ab7308b9 user: js tags: trunk
Changes

Modified src/OFLHAArchive.m from [f92b1ecdad] to [26a6d95955].

212
213
214
215
216
217
218










219
220
221
222
223
224
225
			@throw [OFTruncatedDataException exception];
		}

		headerLen += [_stream readIntoBuffer: header + headerLen
					      length: 21 - headerLen];
	}











	_currentEntry = [[OFLHAArchiveEntry alloc]
	    of_initWithHeader: header
		       stream: _stream
		     encoding: _encoding];

	return _currentEntry;
}







>
>
>
>
>
>
>
>
>
>







212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
			@throw [OFTruncatedDataException exception];
		}

		headerLen += [_stream readIntoBuffer: header + headerLen
					      length: 21 - headerLen];
	}

	/*
	 * Some archives have trailing garbage after the single byte 0
	 * termination. However, a level 2 header uses 2 bytes for the size, so
	 * could just have a header size that is a multiple of 256. Therefore,
	 * consider it only the end of the archive if what follows would not be
	 * a level 2 header.
	 */
	if (header[0] == 0 && header[20] != 2)
		return nil;

	_currentEntry = [[OFLHAArchiveEntry alloc]
	    of_initWithHeader: header
		       stream: _stream
		     encoding: _encoding];

	return _currentEntry;
}