ObjFW  Check-in [9b1de0cac0]

Overview
Comment:OFLHAArchiveEntry: Parse compression method last

This avoids trying to parse the compression method when the header level
is invalid.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.0
Files: files | file ages | folders
SHA3-256: 9b1de0cac05d4fa5e22a44e58ac00b24da2124a9993e57058b0415829e0366ee
User & Date: js on 2024-02-24 13:52:01
Other Links: branch diff | manifest | tags
Context
2024-02-24
15:05
OFLHAArchiveEntry: Add extra sanity checks check-in: 581e18268c user: js tags: 1.0
13:52
OFLHAArchiveEntry: Parse compression method last check-in: 9b1de0cac0 user: js tags: 1.0
13:51
OFLHAArchiveEntry: Parse compression method last check-in: d57a56449f user: js tags: trunk
13:29
OFLHAArchiveEntry: Remove pointless check check-in: d7b824ee7e user: js tags: 1.0
Changes

Modified src/OFLHAArchiveEntry.m from [cf1160a94a] to [170a00bdd8].

332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
332
333
334
335
336
337
338





339
340
341
342
343
344
345







-
-
-
-
-







			 encoding: (OFStringEncoding)encoding
{
	self = [super init];

	@try {
		uint32_t date;

		_compressionMethod = [[OFString alloc]
		    initWithCString: header + 2
			   encoding: OFStringEncodingASCII
			     length: 5];

		memcpy(&_compressedSize, header + 7, 4);
		_compressedSize =
		    OFFromLittleEndian32((uint32_t)_compressedSize);

		memcpy(&_uncompressedSize, header + 11, 4);
		_uncompressedSize =
		    OFFromLittleEndian32((uint32_t)_uncompressedSize);
423
424
425
426
427
428
429





430
431
432
433
434
435
436
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436







+
+
+
+
+








			@throw [OFUnsupportedVersionException
			    exceptionWithVersion: version];
		}

		if (_fileName == nil)
			@throw [OFInvalidFormatException exception];

		_compressionMethod = [[OFString alloc]
		    initWithCString: header + 2
			   encoding: OFStringEncodingASCII
			     length: 5];

		[_extensions makeImmutable];
	} @catch (id e) {
		[self release];
		@throw e;
	}