Description
Describe the bug
Support for large sarif files was added in #1004 which "fixed" #735. However, this only works one time. When the sarif file already exists and the results are reloaded upon clicking the history item, we once again get Showing raw results instead of interpreted ones due to an error. Cannot create a string longer than 0x1fffffe8 characters
error.
It appears to me that the bug is in https://github.com/github/vscode-codeql/blob/main/extensions/ql-vscode/src/query-results.ts#L163-L166, which correctly uses a streaming sarif parser if the file doesn't exists, but uses JSON.parse
if it does (and the latter cannot handle large files). So with that pinpointed, I hope that the fix is easy.
Version
CodeQL extension version: 1.6.9
CodeQL CLI version: 2.10.2
Platform: darwin x64
To reproduce
Run a query producing a large sarif file. Click the result item.
I think SensitiveInfoLog.ql
on elasticsearch/elasticsearch ought to do the trick.
Expected behavior
No crashes, and the path results shown.
Additional context
This is a problem that is in a sense already fixed - we just need to make sure that all code paths actually use the fixed code rather than the broken JSON.parse
.
See also https://github.slack.com/archives/C02SK2TJKPY/p1659692701907299