Skip to content

Commit

Permalink
fixes for CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbutuseless committed Jan 22, 2024
1 parent 045198a commit 84b2eb6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,7 +1,7 @@
Package: yyjsonr
Type: Package
Title: Fast JSON Parser and Generator
Version: 0.1.17
Version: 0.1.17.9000
Authors@R: c(
person("Mike", "Cheng", role = c("aut", "cre", 'cph'),
email = "mikefc@coolbutuseless.com"),
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
@@ -1,4 +1,11 @@


# yyjsonr 0.1.18 2024-01-22

* Fixes for CRAN
* Adjust pointer arithmetic when calling `output_verbose_error()` to
avoid overflow of `size_t`

# yyjsonr 0.1.17 2024-01-20

* Fixes for CRAN
Expand Down
3 changes: 1 addition & 2 deletions src/R-yyjson-parse.c
Expand Up @@ -1807,8 +1807,7 @@ SEXP json_as_robj(yyjson_val *val, parse_options *opt) {
#define ERR_CONTEXT 20
void output_verbose_error(const char *str, yyjson_read_err err) {
// Slice off a bit of the string within +/- ERR_CONTEXT of the error pos
size_t min_idx = err.pos - ERR_CONTEXT;
min_idx = min_idx < 0 ? 0 : min_idx;
size_t min_idx = err.pos < ERR_CONTEXT ? 0 : err.pos - ERR_CONTEXT;
size_t max_idx = err.pos + ERR_CONTEXT;
max_idx = max_idx > strlen(str) ? strlen(str) : max_idx;

Expand Down

0 comments on commit 84b2eb6

Please sign in to comment.