Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix crash when adding %s specifier to color legend label #6795

Merged
merged 1 commit into from Jan 25, 2023

Conversation

Sunderlandkyl
Copy link
Member

If a string specifier followed by a float specifier were added to the label format string, the SNPRINTF call would crash when interpreting the double as a string pointer. Fixed by only printing the value to the first specifier, and by validating that the specifier defines a floating point type.

Fix #3802

lassoan
lassoan previously approved these changes Jan 25, 2023
Copy link
Contributor

@lassoan lassoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, it looks good to me. I've just found a small indentation issue, only fix it if it's easy for you.

If a string specifier followed by a float specifier were added to the label format string, the SNPRINTF call would crash when interpreting the double as a string pointer.
Fixed by only printing the value to the first specifier, and by validating that the specifier defines a floating point type.

Fix Slicer#3802
Copy link
Contributor

@lassoan lassoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@lassoan lassoan merged commit 201ab3a into Slicer:main Jan 25, 2023
@jcfr jcfr added the backport:5.x Identify pull request expected to be backported to the current 5.x release branch. label Jan 26, 2023
@jcfr jcfr removed the backport:5.x Identify pull request expected to be backported to the current 5.x release branch. label Jan 27, 2023
@Sunderlandkyl Sunderlandkyl deleted the 3802_sprintf_crash branch January 27, 2023 17:49
@jcfr jcfr added this to the Slicer 5.2.2 milestone Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Extend label format error checking in vtkSlicerScalarBarActor
3 participants