ObjFW  Check-in [d1293b647a]

Overview
Comment:OFDeflateStream: Fix reading uncompressed header.

In case the uncompressed header was incomplete, this overwrote the old
buffer instead of continuing it.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d1293b647ad59ef0ddb51d40dbf65d80756be6a87fa6a21c36b5e16881248597
User & Date: js on 2013-10-29 22:56:11
Other Links: manifest | tags
Context
2013-10-29
23:37
OFDeflateStream: Get rid of stupid GCC warnings. check-in: 2b11bca0d1 user: js tags: trunk
22:56
OFDeflateStream: Fix reading uncompressed header. check-in: d1293b647a user: js tags: trunk
22:15
OFDeflateStream: Fix tree construction. check-in: aee3bc12f7 user: js tags: trunk
Changes

Modified src/OFDeflateStream.m from [a8810ba694] to [b45e69217a].

349
350
351
352
353
354
355
356
357



358
359
360
361
362
363
364
349
350
351
352
353
354
355


356
357
358
359
360
361
362
363
364
365







-
-
+
+
+







	case UNCOMPRESSED_BLOCK_HEADER:
#define CTX _context.uncompressedHeader
		/* FIXME: This can be done more efficiently than unreading */
		[_stream unreadFromBuffer: _buffer + _bufferIndex
				   length: _bufferLength - _bufferIndex];
		_bufferIndex = _bufferLength = 0;

		CTX.position += [_stream readIntoBuffer: CTX.length
						 length: 4 - CTX.position];
		CTX.position += [_stream
		    readIntoBuffer: CTX.length + CTX.position
			    length: 4 - CTX.position];

		if OF_UNLIKELY (CTX.position < 4)
			return bytesWritten;

		if OF_UNLIKELY ((CTX.length[0] | (CTX.length[1] << 8)) !=
		    (uint16_t)~(CTX.length[2] | (CTX.length[3] << 8)))
			@throw [OFInvalidFormatException exception];