ObjFW  Check-in [c814ea674d]

Overview
Comment:OFGZIPStream: Fix reading CRC32 / size
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c814ea674deac7cce89f1a19f8d9ef1673b5e467e915d16368bd98d8a99e20b3
User & Date: js on 2024-01-27 23:57:54
Other Links: manifest | tags
Context
2024-01-28
13:43
GitHub Actions: Restore *BSD check-in: 5c384cac67 user: js tags: trunk
2024-01-27
23:58
OFGZIPStream: Fix reading CRC32 / size check-in: 7ba7612146 user: js tags: 1.0
23:57
OFGZIPStream: Fix reading CRC32 / size check-in: c814ea674d user: js tags: trunk
2024-01-21
12:19
Update ChangeLog for 1.0.8 check-in: dc20dfdc5f user: js tags: trunk
Changes

Modified src/OFGZIPStream.m from [51e839e54b] to [446ae4ffb6].

246
247
248
249
250
251
252
253

254
255
256
257
258
259
260
261

			[_inflateStream release];
			_inflateStream = nil;

			_state++;
			break;
		case OFGZIPStreamStateCRC32:
			_bytesRead += [_stream readIntoBuffer: _buffer

						       length: 4 - _bytesRead];

			if (_bytesRead < 4)
				return 0;

			CRC32 = ((uint32_t)_buffer[3] << 24) |
			    (_buffer[2] << 16) | (_buffer[1] << 8) | _buffer[0];
			if (~_CRC32 != CRC32) {







|
>
|







246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262

			[_inflateStream release];
			_inflateStream = nil;

			_state++;
			break;
		case OFGZIPStreamStateCRC32:
			_bytesRead += [_stream
			    readIntoBuffer: _buffer + _bytesRead
				    length: 4 - _bytesRead];

			if (_bytesRead < 4)
				return 0;

			CRC32 = ((uint32_t)_buffer[3] << 24) |
			    (_buffer[2] << 16) | (_buffer[1] << 8) | _buffer[0];
			if (~_CRC32 != CRC32) {
270
271
272
273
274
275
276
277

278
279



280
281
282
283
284
285
286
287
			}

			_bytesRead = 0;
			_CRC32 = ~0;
			_state++;
			break;
		case OFGZIPStreamStateUncompressedSize:
			_bytesRead += [_stream readIntoBuffer: _buffer

						       length: 4 - _bytesRead];




			uncompressedSize = ((uint32_t)_buffer[3] << 24) |
			    (_buffer[2] << 16) | (_buffer[1] << 8) | _buffer[0];
			if (_uncompressedSize != uncompressedSize) {
				OFString *actual = [OFString stringWithFormat:
				    @"%" PRIu32, _uncompressedSize];
				OFString *expected = [OFString stringWithFormat:
				    @"%" PRIu32, uncompressedSize];








|
>
|

>
>
>
|







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
			}

			_bytesRead = 0;
			_CRC32 = ~0;
			_state++;
			break;
		case OFGZIPStreamStateUncompressedSize:
			_bytesRead += [_stream
			    readIntoBuffer: _buffer + _bytesRead
				    length: 4 - _bytesRead];

			if (_bytesRead < 4)
				return 0;

			uncompressedSize = (_buffer[3] << 24) |
			    (_buffer[2] << 16) | (_buffer[1] << 8) | _buffer[0];
			if (_uncompressedSize != uncompressedSize) {
				OFString *actual = [OFString stringWithFormat:
				    @"%" PRIu32, _uncompressedSize];
				OFString *expected = [OFString stringWithFormat:
				    @"%" PRIu32, uncompressedSize];