Check for NULL from proj_as_proj_string in proj_factors derived CRS handling#4705
Closed
ClayWarren wants to merge 3 commits intoOSGeo:masterfrom
Closed
Check for NULL from proj_as_proj_string in proj_factors derived CRS handling#4705ClayWarren wants to merge 3 commits intoOSGeo:masterfrom
ClayWarren wants to merge 3 commits intoOSGeo:masterfrom
Conversation
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…ference-in-proj_factors Check for NULL from proj_as_proj_string in proj_factors derived CRS handling
Member
|
@ClayWarren Why did you delete this PR ? This looked good to me |
Author
|
I deleted my fork, I'm still learning. |
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.
Motivation
proj_factors()for derived projected CRS constructed astd::stringfrom the return value ofproj_as_proj_string()without checking forNULL, which can occur when an object is not exportable or on export error and causes undefined behavior/crash.Description
NULLcheck for the result ofproj_as_proj_string()and return safely (after cleaning up) if export fails, avoiding construction ofstd::stringfromNULLin the derived projected CRS branch. (modifiedsrc/factors.cpp).proj_create()and return safely on failure instead of relying only onassert()(modifiedsrc/factors.cpp).proj_factors()returns an error condition rather than crashing (added test intest/unit/gie_self_tests.cpp).Testing
Configured with CMake (
-DCMAKE_BUILD_TYPE=Release) successfully in this environment. (succeeded)Built the project with
cmake --buildsuccessfully and produced binaries. (succeeded)Exercised the produced
projbinary with a simple projection invocation (./build/bin/proj +proj=merc +ellps=WGS84) which produced expected numeric output. (succeeded)AI/LLM (Codex Security in research preview) supported my development of this PR
Tests added
Added clear title that can be used to generate release notes