ObjFW  Check-in [4c56240653]

Overview
Comment:OFLHAArchiveEntry: Add extra sanity checks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4c56240653366e46cc4b7c5beb82142e266b2e60666b85b2803611846f62ccb3
User & Date: js on 2024-02-24 15:05:13
Other Links: manifest | tags
Context
2024-02-24
16:17
OFLHAArchive: Add support for -lz4- files check-in: 42ab7308b9 user: js tags: trunk
15:05
OFLHAArchiveEntry: Add extra sanity checks check-in: 581e18268c user: js tags: 1.0
15:05
OFLHAArchiveEntry: Add extra sanity checks check-in: 4c56240653 user: js tags: trunk
13:51
OFLHAArchiveEntry: Parse compression method last check-in: d57a56449f user: js tags: trunk
Changes

Modified src/OFLHAArchiveEntry.m from [ed305bf072] to [76b8e70f25].

362
363
364
365
366
367
368



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383




384
385
386
387
388
389
390
		case 0:
		case 1:;
			void *pool = objc_autoreleasePoolPush();
			uint8_t extendedAreaSize;
			uint8_t fileNameLength;
			OFString *tmp;




			_modificationDate = [parseMSDOSDate(date) retain];

			fileNameLength = [stream readInt8];
			tmp = [stream readStringWithLength: fileNameLength
						  encoding: encoding];
			tmp = [tmp stringByReplacingOccurrencesOfString: @"\\"
							     withString: @"/"];
			_fileName = [tmp copy];

			_CRC16 = [stream readLittleEndianInt16];

			extendedAreaSize =
			    header[0] - (21 - 2) - 1 - fileNameLength - 2;

			if (_headerLevel == 1) {




				_operatingSystemIdentifier = [stream readInt8];

				/*
				 * 1 for the operating system identifier, 2
				 * because we don't want to skip the size of
				 * the next extended header.
				 */







>
>
>















>
>
>
>







362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
		case 0:
		case 1:;
			void *pool = objc_autoreleasePoolPush();
			uint8_t extendedAreaSize;
			uint8_t fileNameLength;
			OFString *tmp;

			if (header[0] < (21 - 2) + 1 + 2)
				@throw [OFInvalidFormatException exception];

			_modificationDate = [parseMSDOSDate(date) retain];

			fileNameLength = [stream readInt8];
			tmp = [stream readStringWithLength: fileNameLength
						  encoding: encoding];
			tmp = [tmp stringByReplacingOccurrencesOfString: @"\\"
							     withString: @"/"];
			_fileName = [tmp copy];

			_CRC16 = [stream readLittleEndianInt16];

			extendedAreaSize =
			    header[0] - (21 - 2) - 1 - fileNameLength - 2;

			if (_headerLevel == 1) {
				if (extendedAreaSize < 3)
					@throw [OFInvalidFormatException
					    exception];

				_operatingSystemIdentifier = [stream readInt8];

				/*
				 * 1 for the operating system identifier, 2
				 * because we don't want to skip the size of
				 * the next extended header.
				 */