ObjFW  Check-in [d57a56449f]

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 | trunk
Files: files | file ages | folders
SHA3-256: d57a56449fb8172a8b4278b3471038fa004b2a655e7c1f13809fca1ccc278019
User & Date: js on 2024-02-24 13:51:46
Other Links: manifest | tags
Context
2024-02-24
15:05
OFLHAArchiveEntry: Add extra sanity checks check-in: 4c56240653 user: js tags: trunk
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: 4b6a09da4c user: js tags: trunk
Changes

Modified src/OFLHAArchiveEntry.m from [c2a59c307b] to [ed305bf072].

340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
			 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);







<
<
<
<
<







340
341
342
343
344
345
346





347
348
349
350
351
352
353
			 encoding: (OFStringEncoding)encoding
{
	self = [super init];

	@try {
		uint32_t date;






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

		memcpy(&_uncompressedSize, header + 11, 4);
		_uncompressedSize =
		    OFFromLittleEndian32((uint32_t)_uncompressedSize);
436
437
438
439
440
441
442





443
444
445
446
447
448
449

			@throw [OFUnsupportedVersionException
			    exceptionWithVersion: version];
		}

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






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








>
>
>
>
>







431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449

			@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;
	}