Add validation of scanf format and arguments#10852
Add validation of scanf format and arguments#10852thewilsonator merged 10 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @Luhrel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#10852" |
There was a problem hiding this comment.
Most of the logic here seems like a duplicate of chkprintf.d. Is there any difference between the mirrored functions? Even if there is, it should be minimal. I suggest that chkprintf file is renamed to chkformat and try to reuse the code as much as possible. For example: the parseFormatSpecifier function should be identical for both situations, there is no need in duplicating it; even if there are some differences, those should be special cased with if-else branches. Another example is the enum Format declaration: 2 declarations of the same thing.
|
Are |
Done.
Now, yes. |
thewilsonator
left a comment
There was a problem hiding this comment.
Also the changelog should mention that the file and string variants of scanf are also validated. This changelog entry should be merged with the printf one (if that hasn't already been released). It should also mention that fprintf and sprintf are also validated.
|
This PR seems to have some issues with |
Now `chkscanf` and `chkprintf` use the same base function for parsing a generic `Format`.
|
The errors in the test suite are about druntime's use of I recommend removing |
|
Done. @WalterBright Maybe you can merge this now. |
@WalterBright asked for it in the forums, so here it is.
Highly inspired by #10812.