Skip to content

Strip leading ./ from SARIF artifact URIs for uriBaseId portability#102

Merged
david-a-wheeler merged 6 commits into
masterfrom
improvements2
May 17, 2026
Merged

Strip leading ./ from SARIF artifact URIs for uriBaseId portability#102
david-a-wheeler merged 6 commits into
masterfrom
improvements2

Conversation

@david-a-wheeler

Copy link
Copy Markdown
Owner

Removes leading "./" prefixes from file paths in SARIF output so they work correctly with the uriBaseId/SRCROOT placeholder, as requested in #67. Paths beginning with "-" retain "./" to avoid misinterpretation as CLI options by downstream tools.

david-a-wheeler and others added 6 commits May 17, 2026 15:07
Removes leading "./" prefixes from file paths in SARIF output so they
work correctly with the uriBaseId/SRCROOT placeholder, as requested in
#67.
Paths beginning with "-" retain "./" to avoid misinterpretation as CLI
options by downstream tools.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Functions named inside GCC attribute arguments (e.g. format(printf,...))
are compiler metadata, not callable expressions, and should not be flagged.
When __attribute__ is encountered in the token scan, _skip_attribute_args()
advances past the entire balanced ((...)) argument.

Known limitation: paren counting ignores string literals, so attribute
string arguments containing unbalanced '(' are a known edge case.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
swprintf(buf, n, format, ...) has the format string at position 3, not 2.
The old rule grouped swprintf with sprintf (position 2), so flawfinder
was inspecting the size argument n rather than the format string, causing
false positives on constant formats and missing non-constant ones.

Split swprintf|vswprintf into their own rule with source_position=3, and
add source_position to the Hit allowlist so rule overrides take effect.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
@david-a-wheeler
david-a-wheeler merged commit c4216b7 into master May 17, 2026
5 checks passed
@david-a-wheeler
david-a-wheeler deleted the improvements2 branch May 17, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant