You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happened:
The strconv.ParseInt function is unable to correctly parse hexadecimal numbers when the input string contains "0XD" because it interprets the entire string, including the "0X" prefix, as part of the value. As a result, it throws the error: strconv.ParseInt: parsing "0XD": invalid syntax. This issue occurs because ParseInt expects a valid hexadecimal string, but "0XD" is not a valid representation when processed directly.
What you expected to happen:
I expected the parseLinuxKernelMetadata function to correctly parse the hexadecimal value after the "0X" prefix, so that "0XD" would be interpreted as "D" (hexadecimal for 13), resulting in a valid integer value.
Have a vmlinuz file in the file system with swap_dev 0XD (or any other valid hex value);
The error strconv.ParseInt: parsing "0XD": invalid syntax will be thrown;
Output example:
$ sudo syft /boot
✔ Indexed file system /boot
✔ Cataloged contents 347a1e2537cc7aea90a4938443f967a544ea0e3f60fdc4cb45c3347a3df94bc9
├── ✔ Packages [3 packages]
├── ✔ File digests [3 files]
├── ✔ File metadata [3 locations]
└── ✔ Executables [13 executables]
[0000] WARN no explicit name and version provided for directory source, deriving artifact ID from the given path (which is not ideal)
[0001] WARN unable to parse swap device: strconv.ParseInt: parsing "0XE": invalid syntax
[0001] WARN unable to parse swap device: strconv.ParseInt: parsing "0XD": invalid syntax
[0001] WARN unable to parse swap device: strconv.ParseInt: parsing "0XE": invalid syntax
[0001] WARN unable to parse swap device: strconv.ParseInt: parsing "0XE": invalid syntax
NAME VERSION TYPE
linux-kernel xx-generic linux-kernel
linux-kernel xx-generic linux-kernel
linux-kernel xx-generic linux-kernel
Anything else we need to know?:
The Test_KernelCataloger function fails to account for the correct parsed value of the swap and root devices, as it expects both values to be 0 rather than the actual parsed value.
What happened:
The
strconv.ParseInt
function is unable to correctly parse hexadecimal numbers when the input string contains "0XD" because it interprets the entire string, including the "0X" prefix, as part of the value. As a result, it throws the error:strconv.ParseInt: parsing "0XD": invalid syntax
. This issue occurs becauseParseInt
expects a valid hexadecimal string, but "0XD" is not a valid representation when processed directly.What you expected to happen:
I expected the
parseLinuxKernelMetadata
function to correctly parse the hexadecimal value after the "0X" prefix, so that "0XD" would be interpreted as "D" (hexadecimal for 13), resulting in a valid integer value.Source: syft/pkg/cataloger/kernel/parse_linux_kernel_file.go
Steps to reproduce the issue:
vmlinuz
file in the file system withswap_dev 0XD
(or any other valid hex value);strconv.ParseInt: parsing "0XD": invalid syntax
will be thrown;Output example:
Anything else we need to know?:
The
Test_KernelCataloger
function fails to account for the correct parsed value of the swap and root devices, as it expects both values to be 0 rather than the actual parsed value.Source: syft/pkg/cataloger/kernel/cataloger_test.go
Environment:
syft version
:cat /etc/os-release
or similar):The text was updated successfully, but these errors were encountered: