From 60c37844d7a1c97547812cac3423d458c73e60f9 Mon Sep 17 00:00:00 2001 From: Valerie Avva Lim <54871851+vaavva@users.noreply.github.com> Date: Sun, 21 May 2023 01:15:39 -0700 Subject: [PATCH] 1.5.2: fix Arithmetic overflow (#204) * fix Arithmetic overflow * address PR comment and update version --- CMakeLists.txt | 2 +- meson.build | 2 +- package.json | 2 +- parson.c | 6 +++--- parson.h | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d0d24a..b34fcbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ project(parson C) include (GNUInstallDirs) -set(PARSON_VERSION 1.5.1) +set(PARSON_VERSION 1.5.2) add_library(parson parson.c) target_include_directories(parson PUBLIC $) diff --git a/meson.build b/meson.build index 301f2b2..0fb84d9 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('parson', 'c', - version : '1.5.1', + version : '1.5.2', license : 'MIT', meson_version : '>=0.46.0', default_options : [ diff --git a/package.json b/package.json index b6fc08b..cce306f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parson", - "version": "1.5.1", + "version": "1.5.2", "repo": "kgabis/parson", "description": "Small json parser and reader", "keywords": [ "json", "parser" ], diff --git a/parson.c b/parson.c index e024332..4a18fe9 100644 --- a/parson.c +++ b/parson.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: MIT - Parson 1.5.1 (https://github.com/kgabis/parson) + Parson 1.5.2 (https://github.com/kgabis/parson) Copyright (c) 2012 - 2023 Krzysztof Gabis Permission is hereby granted, free of charge, to any person obtaining a copy @@ -32,7 +32,7 @@ #define PARSON_IMPL_VERSION_MAJOR 1 #define PARSON_IMPL_VERSION_MINOR 5 -#define PARSON_IMPL_VERSION_PATCH 1 +#define PARSON_IMPL_VERSION_PATCH 2 #if (PARSON_VERSION_MAJOR != PARSON_IMPL_VERSION_MAJOR)\ || (PARSON_VERSION_MINOR != PARSON_IMPL_VERSION_MINOR)\ @@ -441,7 +441,7 @@ static JSON_Status json_object_init(JSON_Object *object, size_t capacity) { object->count = 0; object->cell_capacity = capacity; - object->item_capacity = (unsigned int)(capacity * 0.7f); + object->item_capacity = (unsigned int)(capacity * 7/10); if (capacity == 0) { return JSONSuccess; diff --git a/parson.h b/parson.h index 1aeaf88..77b451e 100644 --- a/parson.h +++ b/parson.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: MIT - Parson 1.5.1 (https://github.com/kgabis/parson) + Parson 1.5.2 (https://github.com/kgabis/parson) Copyright (c) 2012 - 2023 Krzysztof Gabis Permission is hereby granted, free of charge, to any person obtaining a copy @@ -36,9 +36,9 @@ extern "C" #define PARSON_VERSION_MAJOR 1 #define PARSON_VERSION_MINOR 5 -#define PARSON_VERSION_PATCH 1 +#define PARSON_VERSION_PATCH 2 -#define PARSON_VERSION_STRING "1.5.1" +#define PARSON_VERSION_STRING "1.5.2" #include /* size_t */