Fix audit bugs (#1, #2, #3) and regenerate distorted logo - #6
Merged
Conversation
Audit fixes: - #1 src/pikchr.c: free() the malloc'd buffer returned by pikchr() in pikchr_c() (was leaking the full SVG string on every render) and guard against a NULL return (mkChar(NULL) would crash R) by emitting NA. Also switch the legacy STRING_VALUE macro to CHAR(STRING_ELT(...)). - #2 R/pikchrWrappers.R: fix the height default. The second guard tested `width` again (always FALSE), so `height` never defaulted from the viewBox and produced an empty `height:;` CSS rule. - #3 R/pikchrWrappers.R + man/pikchr.Rd: align documented @param defaults with the actual signature (width/height -> viewBox, fontSize 100%, fontFamily Jost, align none). Logo: regenerate man/figures/pikchrHex.svg and logo.png with a geometrically regular hexagon (was squished, ratio 0.73 vs 0.866) and fix the invalid <def> element (-> <defs>). Generator added under tools/. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Bump to 1.1.1 (patch) with today's date. - Document the audit bug fixes in NEWS.md. - Update cran-comments.md for the bug-fix resubmission. - Add .claude/ to .Rbuildignore so it is not bundled in the tarball (R CMD check --as-cran flagged it as a hidden directory). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the package audit findings.
Bug fixes
#1 — Memory leak in
pikchr_c()(src/pikchr.c)pikchr()returns amalloc/realloc'd buffer that was never freed, leaking the entire SVG string on every render. Nowfree()d after copying into the R string. Also guards a possibleNULLreturn (mkChar(NULL)would crash R) by emittingNA, and replaces the legacySTRING_VALUEmacro withCHAR(STRING_ELT(...)).#2 — Broken
heightdefault (R/pikchrWrappers.R)The second guard now tests
height, so it correctly defaults to the viewBox height instead of producing an emptyheight:;CSS rule.#3 — Documented defaults didn't match actual defaults (
R/pikchrWrappers.R,man/pikchr.Rd)Aligned
@paramdocs with the real signature:width/height→ viewBox intrinsic,fontSize→100%,fontFamily→Jost,align→none. Docs regenerated with roxygen2.Logo
Regenerated
man/figures/pikchrHex.svgandman/figures/logo.pngwith a geometrically regular hexagon (was squished, width/height 0.73 vs 0.866) and fixed the invalid<def>element (→<defs>). Deterministic generator added undertools/(excluded from the build via.Rbuildignore).Verification
R CMD SHLIB pikchr.c init.ccompiles cleanly (no warnings).<svg>; error path returns a non-NA character scalar.Closes #1
Closes #2
Closes #3
🤖 Generated with Claude Code