Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method retrieveContent() in FileScancodeRawComponentInfoProvider should handle non standard text files correctly #277

Open
ohecker opened this issue Jul 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ohecker
Copy link
Member

ohecker commented Jul 24, 2024

The method retrieveContent() in FileScancodeRawComponentInfoProvider is used to read file content (license texts and notice file content) from the downloaded package source files. The files to be read are determined by the scancode result file. Optionally retrieveContent() might also extract a subset of lines from the read file.

Whilst this works well for "normal" text files (classic source files), the files referenced in the scancode result file might also be text files without classic line feeds (like .js.map files) or even binary files (like .node). Solicitor currently lacks any functionality to transform the contents of such files into a format suitable for printing and/or to extract specific lines from the files.

Specifically above referenced .node files might be very large (e.g. around 100MB). Within method retrieveContent() the referenced file content is always read into the main memory. In case of such large files this might destabilize Solicitor due to Out-of-Memory errors.

FileScancodeRawComponentInfoProvider#retrieveContent() should be improved to:

  • also be able to generate printable content for non standard text files (like .js.map or .node)
  • this includes extracting dedicated line ranges from the file
  • avoid the danger of OOM even for large files

Unless support for these file types is implemented there should be at least a protection implemented to avoid OOM.
Easiest approach might be to reject processing of files larger than e.g. 1MB in size (assuming that normal source files are smaller than 1MB)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant