Skip to content

BlueScreen callstack output can be looped by writing a exception with recursion previous property #499

Closed
@janbarasek

Description

@janbarasek

Version: all

Bug Description

In Tracy, there is a way to use recursive exceptions to drop the entire capture process via repeatedly writing previous.

Steps To Reproduce

How to kill your application.

Use this code:

$a = new class extends \RuntimeException {
	public function setPrevious(\Throwable $e): void
	{
		$ref = new \ReflectionClass($this);
		$parent = $ref->getParentClass()->getParentClass();
		$previous = $parent->getProperty('previous');
		$previous->setAccessible(true);
		$previous->setValue($this, $e);
	}
};
$a->setPrevious($a);

// this line will kill your BlueScreen:
throw $a;

Dumped value is:

Snímek obrazovky 2021-08-03 v 20 19 32

Note the recursion on the previous property, where Tracy recognizes it correctly. This logic must also be in the callstack statement.

Expected Behavior

Stop callstack dumping in case of recursion, or at least limit the depth.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions