ObjFW  Check-in [355d3a9dc3]

Overview
Comment:-[objectByParsingMessagePack]: Fix signed numbers
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.0
Files: files | file ages | folders
SHA3-256: 355d3a9dc3e79d9ed494396b14d90f6d2d0078802769edccb5a10c9b4bfb3901
User & Date: js on 2024-03-17 22:41:09
Other Links: branch diff | manifest | tags
Context
2024-03-29
13:59
OFFileManager: Fix getting non-existent xattr check-in: 23cee06a0e user: js tags: 1.0
2024-03-17
22:41
-[objectByParsingMessagePack]: Fix signed numbers check-in: 355d3a9dc3 user: js tags: 1.0
22:40
-[objectByParsingMessagePack]: Fix signed numbers check-in: e3001a706c user: js tags: trunk
17:36
GitHub Actions: Split MSYS2 into multiple steps check-in: ded1893e80 user: js tags: 1.0
Changes

Modified src/OFData+MessagePackParsing.m from [5553f1238c] to [e56d8e63a6].

254
255
256
257
258
259
260
261
262
263
264
265
266
267

268
269
270
271
272
273

274
275
276
277
278
279

280
281
282
283
284
285
286
		    readUInt64(buffer + 1)];
		return 9;
	/* Signed integers */
	case 0xD0: /* int 8 */
		if (length < 2)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithChar: buffer[1]];
		return 2;
	case 0xD1: /* int 16 */
		if (length < 3)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithShort: readUInt16(buffer + 1)];

		return 3;
	case 0xD2: /* int 32 */
		if (length < 5)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithLong: readUInt32(buffer + 1)];

		return 5;
	case 0xD3: /* int 64 */
		if (length < 9)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithLongLong: readUInt64(buffer + 1)];

		return 9;
	/* Floating point */
	case 0xCA:; /* float 32 */
		float f;

		if (length < 5)
			@throw [OFTruncatedDataException exception];







|





|
>





|
>





|
>







254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
		    readUInt64(buffer + 1)];
		return 9;
	/* Signed integers */
	case 0xD0: /* int 8 */
		if (length < 2)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithChar: (int8_t)buffer[1]];
		return 2;
	case 0xD1: /* int 16 */
		if (length < 3)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithShort:
		    (int16_t)readUInt16(buffer + 1)];
		return 3;
	case 0xD2: /* int 32 */
		if (length < 5)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithLong:
		    (int32_t)readUInt32(buffer + 1)];
		return 5;
	case 0xD3: /* int 64 */
		if (length < 9)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithLongLong:
		    (int64_t)readUInt64(buffer + 1)];
		return 9;
	/* Floating point */
	case 0xCA:; /* float 32 */
		float f;

		if (length < 5)
			@throw [OFTruncatedDataException exception];