Skip to content

Commit f6488d7

Browse files
Using constant string vector instead of irep_idt
The irep_idt class may not have been initialized when we reach this vector declaration, which could lead to a runtime error. Using a vector of string instead is safe.
1 parent 6d657a0 commit f6488d7

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/java_bytecode/java_bytecode_instrument.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,12 @@ class java_bytecode_instrumentt:public messaget
7979
codet instrument_expr(const exprt &expr);
8080
};
8181

82-
83-
const std::vector<irep_idt> exception_needed_classes =
84-
{
82+
const std::vector<std::string> exception_needed_classes = { // NOLINT
8583
"java.lang.ArithmeticException",
8684
"java.lang.ArrayIndexOutOfBoundsException",
8785
"java.lang.ClassCastException",
8886
"java.lang.NegativeArraySizeException",
89-
"java.lang.NullPointerException"
90-
};
87+
"java.lang.NullPointerException"};
9188

9289
/// Creates a class stub for exc_name and generates a
9390
/// conditional GOTO such that exc_name is thrown when

src/java_bytecode/java_bytecode_instrument.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ void java_bytecode_instrument(
2626
const bool throw_runtime_exceptions,
2727
message_handlert &_message_handler);
2828

29-
extern const std::vector<irep_idt> exception_needed_classes;
29+
extern const std::vector<std::string> exception_needed_classes;
3030

3131
#endif

0 commit comments

Comments
 (0)