designsecurity / progpilot

A static analysis tool for security
MIT License
332 stars 61 forks source link

Call to a member function computeCallGraph() on null #57

Closed ivansaurio closed 6 months ago

ivansaurio commented 1 year ago

I've run into this crash using both the latest release and compiling from master

PHP Warning:  Undefined array key 2684881 in phar:///tmp/progpilot.phar/vendor/progpilot/package/src/progpilot/Analysis/VisitorAnalysis.php on line 426
PHP Fatal error:  Uncaught Error: Call to a member function computeCallGraph() on null in phar:///tmp/progpilot.phar/vendor/progpilot/package/src/progpilot/Analysis/VisitorAnalysis.php:427
Stack trace:
#0 phar:///tmp/progpilot.phar/vendor/progpilot/package/src/progpilot/Analyzer.php(149): progpilot\Analysis\VisitorAnalysis->analyzeFunc()
#1 phar:///tmp/progpilot.phar/vendor/progpilot/package/src/progpilot/Analyzer.php(321): progpilot\Analyzer->runFunctionAnalysis()
#2 phar:///tmp/progpilot.phar/vendor/progpilot/package/src/progpilot/Analyzer.php(442): progpilot\Analyzer->runAnalysisOfCurrentMyFile()
#3 phar:///tmp/progpilot.phar/vendor/progpilot/package/src/progpilot/Command/ProgpilotCommand.php(62): progpilot\Analyzer->run()
#4 phar:///tmp/progpilot.phar/vendor/symfony/console/Command/Command.php(298): progpilot\Command\ProgpilotCommand->execute()
#5 phar:///tmp/progpilot.phar/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#6 phar:///tmp/progpilot.phar/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#7 phar:///tmp/progpilot.phar/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#8 phar:///tmp/progpilot.phar/vendor/progpilot/package/src/progpilot/Console/Application.php(29): Symfony\Component\Console\Application->run()
#9 phar:///tmp/progpilot.phar/progpilot(19): progpilot\Console\Application->run()
#10 /tmp/progpilot.phar(12): require('...')
#11 {main}
  thrown in phar:///tmp/progpilot.phar/vendor/progpilot/package/src/progpilot/Analysis/VisitorAnalysis.php on line 427

Reproduction steps

wget https://github.com/PrestaShop/PrestaShop/releases/download/1.7.6.8/prestashop_1.7.6.8.zip
unzip prestashop_1.7.6.8.zip
unzip prestashop.zip
wget https://github.com/designsecurity/progpilot/releases/download/v1.0.2/progpilot_v1.0.2.phar -O /tmp/progpilot.phar
php /tmp/progpilot.phar .
$ php --version
PHP 8.1.2-1ubuntu2.13 (cli) (built: Jun 28 2023 14:01:49) (NTS)
eric-therond commented 6 months ago

Thanks for the bug report should be fixed with v1.1.0 don't hesitate to reopen the issue if you see something missing