Skip to content

Commit 0ed21ca

Browse files
author
Matthias Güdemann
committed
Treat empty optional case separately
In the case of an empty lambda_method_handlert, it was possible to try to access the non-existent value. This PR fixes the case in the sense that an empty optionalt is never dereferenced.
1 parent fe34bf6 commit 0ed21ca

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/java_bytecode/java_bytecode_parser.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,10 +1893,18 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
18931893
optionalt<lambda_method_handlet> lambda_method_handle =
18941894
parse_method_handle(method_handle_infot{method_handle_argument});
18951895

1896-
if(
1897-
!lambda_method_handle.has_value() ||
1896+
if(!lambda_method_handle.has_value())
1897+
{
1898+
lambda_method_handlet lambda_method_handle;
1899+
lambda_method_handle.handle_type = method_handle_typet::UNKNOWN_HANDLE;
1900+
lambda_method_handle.u2_values = std::move(u2_values);
1901+
parsed_class.lambda_method_handle_map[{parsed_class.name, i}] =
1902+
lambda_method_handle;
1903+
return;
1904+
}
1905+
else if(
18981906
lambda_method_handle->handle_type !=
1899-
method_handle_typet::LAMBDA_METHOD_HANDLE)
1907+
method_handle_typet::LAMBDA_METHOD_HANDLE)
19001908
{
19011909
lambda_method_handle->u2_values = std::move(u2_values);
19021910
error() << "ERROR: could not parse lambda function method handle"

0 commit comments

Comments
 (0)