-
-
Notifications
You must be signed in to change notification settings - Fork 56.3k
more sprintf removals #23055
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
more sprintf removals #23055
Conversation
@seanm Friendly reminder. Is the PR still in progress? |
@asmorkalov I've been waiting to hear from an OpenCV developer. I marked it as WIP just so no one would merge it as-is. Biggest thing to discuss is if the approach of either/both of the 2 WIP commits is acceptible... |
These were non-trivial, requiring some pointer arithmetic.
…er length This allows replacing the unsafe sprintf with snprintf Also increased buffer size at call sites to be a little bigger, in case int is 64 bit.
Some places used 32, some 40. Increased them all to a littel bigger (50). It seems the largest possible string is currently 24 bytes, but future changes may require more space. Changed convertTypeStr from using the unsafe sprintf to snprintf. Alas, since the buffer size is not given to convertTypeStr, hardcode 50, which matches all the buffers actually passed.
@asmorkalov this is ready to commit IMHO. Care to review? I dropped the WIP commit and will make another PR with it. |
@opencv-alalek Could you take a look too? |
And here is the other/followup PR: #23502 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
* Replaced most remaining sprintf with snprintf * Deprecated encodeFormat and introduced new method that takes the buffer length * Also increased buffer size at call sites to be a little bigger, in case int is 64 bit
* Replaced most remaining sprintf with snprintf * Deprecated encodeFormat and introduced new method that takes the buffer length * Also increased buffer size at call sites to be a little bigger, in case int is 64 bit
No description provided.