osquery
osquery copied to clipboard
Fix file carve table under debug builds.
The type assertion will fail after the initial update to the size since the calculated size is written as a string. This checks the type before loading.
Fixes #7756
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: apinter-figma (3cdb7318c753cebabc992c0a31ebac91ce621b2f)
Reading https://github.com/osquery/osquery/issues/7756 it seems like a better approach would be to fix the transform function that isn't returning an int. Do you have any idea what's happening there?
@apinter-figma I agree with @seph, I think it's better to have consistency.
As I far I see in the code the issue seems to be that updateCarveValue https://github.com/osquery/osquery/blob/01ed1f6b3458ec7147a7b1a06aea259ed0f906aa/osquery/carver/carver_utils.cpp#L33-L50 always takes values as strings and adds them to the document as is. So if size has to be updated, it becomes a string.
At the same time though we are defaulting size to an int (-1) in carvePaths:
https://github.com/osquery/osquery/blob/01ed1f6b3458ec7147a7b1a06aea259ed0f906aa/osquery/carver/carver_utils.cpp#L68-L80
#8297 is my attempt at solving this same issue.
Closing for #8297