jlfwong / speedscope

🔬 A fast, interactive web-based viewer for performance profiles.
https://www.speedscope.app
MIT License
5.45k stars 237 forks source link

Add bounds checking for sampleTypeIndex #449

Closed jlfwong closed 9 months ago

jlfwong commented 9 months ago

Wow this was surprising. As reported in #448, the simple.speedscope.json file failed import. This was surprising to me because there's a test that covers that file to ensure it imports correctly.

The file provided in #448, however, is from a version of speedscope from 5 years ago before the file had been pretty printed. It turns out that when this particular file is not pretty-printed, it's a schematically valid pprof profile.

The fix is to do some bounds checks and return null. After the change, the file imports as you'd expect after realizing its not actually a valid pprof profile.

Fixes #448

coveralls commented 9 months ago

Coverage Status

coverage: 43.041% (+0.09%) from 42.952% when pulling 87391ee7ad6a53d8d1f2091190ba87b171820129 on jlfwong/add-more-error-checking-for-pprof-import into de17f128d0ce9d2a696ac7772dec6393dc2888b4 on main.