ObjFW  Check-in [581e18268c]

Overview
Comment:OFLHAArchiveEntry: Add extra sanity checks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.0
Files: files | file ages | folders
SHA3-256: 581e18268ca8fe6bd61caded6ffbb494bb2558748858a2cd99b471f225613f4f
User & Date: js on 2024-02-24 15:05:37
Other Links: branch diff | manifest | tags
Context
2024-02-24
17:25
OFLHAArchive: Ignore trailing garbage check-in: 927d1693c6 user: js tags: 1.0
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:52
OFLHAArchiveEntry: Parse compression method last check-in: 9b1de0cac0 user: js tags: 1.0
Changes

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

354
355
356
357
358
359
360



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375




376
377
378
379
380
381
382
		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.
				 */







>
>
>















>
>
>
>







354
355
356
357
358
359
360
361
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
		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.
				 */