3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-20 02:00:22 +00:00

Fix nullptr dereference in pp_symbol when handling null symbol names (#7790)

* Initial plan

* Fix nullptr dereference in pp_symbol with null symbol names

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
Copilot 2025-08-17 10:25:51 -07:00 committed by GitHub
parent a121e6c6e9
commit d8bf0e047f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -42,8 +42,13 @@ static unsigned pp_symbol(std::ostream & out, symbol const & s) {
return static_cast<unsigned>(str.length());
}
else {
out << s.bare_str();
return static_cast<unsigned>(strlen(s.bare_str()));
if (s.is_null()) {
out << "null";
return 4; // length of "null"
} else {
out << s.bare_str();
return static_cast<unsigned>(strlen(s.bare_str()));
}
}
}