Repository navigation
Avoid potential protection stack overflow in bboxCalcR_c - #160
Merged
Merged
Conversation
Owner
|
Nice catch - thanks! |
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.
Hello,
Thank you for your work on this package. I understand that it is in the process of being deprecated / is in maintenance mode; I'm hoping this PR can be considered as part of a patch update. It includes a fix for regression in behavior that seems to have been introduced in the latest version on CRAN,
v2.2-3.I was made aware of this issue via satijalab/seurat#10527.
For context: we currently use the
SpatialPolygonsclass from your package to handle certain types of single-cell spatial transcriptomics data (and also hope to transition fully tosfsoon). Recently, users withspversionv2.2-3have reportedError: protect(): protection stack overflowon object-creation functions that use theSpatialPolygonsconstructor.I looked into this by going through the changes introduced in
v2.2-3, and I think the culprit is thebboxCalcR_cfunction. There are calls toPROTECTeach polygon during the loop to go through all vertex coordinates to calculate the bounding box...sp/src/sp_xports.c
Lines 468 to 479 in a4624aa
This PR proposes to simply add a call to
UNPROTECTcrds, and decrementpc, after accessing the coordinates of all vertices for the given polygon.Example
I've included a reprex of the error below. It runs successfully loading a checkout of this branch.
Created on 2026-10-09 with reprex v2.1.1
Tests
With this edit, all package tests pass (run locally under Ubuntu 20.04.6 LTS).