Skip to content

fix(binary): normalize comma-separated PE version resources - #5112

Open
Eljees wants to merge 1 commit into
anchore:mainfrom
Eljees:agent/fix-pe-comma-version
Open

fix(binary): normalize comma-separated PE version resources#5112
Eljees wants to merge 1 commit into
anchore:mainfrom
Eljees:agent/fix-pe-comma-version

Conversation

@Eljees

@Eljees Eljees commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Normalizes the comma-separated version form found in Windows PE VERSIONINFO resources, so 3, 0, 21, 0 becomes 3.0.21.0.

Why

Windows resource string tables frequently mirror the .rc declaration (FILEVERSION 3,0,21,0) rather than the dotted form. Syft used that value verbatim as the package version, which is visible in #5075 — VLC is reported as:

cpe:2.3:a:VLC_media_player:VLC_media_player:3\,0\,21\,0:*:*:*:*:*:*:*

A version containing escaped commas matches nothing in vulnerability data, and the same value flows into the PURL and the package version shown to users.

This only addresses the version portion of that issue; the vendor/product naming discussion there is separate and left alone.

Details

  • extractVersionFromResourcesValue now normalizes a value that consists entirely of comma-separated numbers (with optional surrounding spaces) to the dotted form.
  • Anything else is returned unchanged, so values like 1.2.3 (build 456) keep their existing handling and a value such as 1.0, beta is not rewritten.

Tests

Added Test_findVersionFromVR covering dotted input, both comma-separated forms (3, 0, 21, 0 and 3,0,21,0), a version with a trailing comment, and a non-numeric comma value. go test ./syft/pkg/cataloger/binary/ passes.

Windows VERSIONINFO string tables often carry the .rc-style
comma-separated form of a version (mirroring FILEVERSION 3,0,21,0), so
binaries such as VLC report a version of "3, 0, 21, 0". That value was
used verbatim as the package version, which produced identifiers like
cpe:2.3:a:...:3\,0\,21\,0 that match nothing in vulnerability data.

Normalize values that consist entirely of comma-separated numbers into
the canonical dotted form; anything else (including versions with a
trailing comment) is left untouched.

Signed-off-by: Eljees <3.14hell@gmail.com>
@Eljees

Eljees commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Ping on this one and #5114 - both open since late July, no review yet. They touch different areas (binary PE version resources and the CycloneDX decoder) and are independent.

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