Skip to content

Commit 745afbc

Browse files
author
Daniel Kroening
authored
Merge pull request #1796 from thk123/refactor/bytecode-parsing-tidy
Java Bytecode parsing tidy
2 parents 6f6fda7 + 4a538d2 commit 745afbc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/java_bytecode/java_bytecode_convert_method.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ Author: Daniel Kroening, [email protected]
4545
#include <unordered_set>
4646
#include <regex>
4747

48+
/// Given a string of the format '?blah?', will return true when compared
49+
/// against a string that matches appart from any characters that are '?'
50+
/// in the original string. Equivalent to doing a regex match on '.blah.'
4851
class patternt
4952
{
5053
public:

src/java_bytecode/java_bytecode_parser.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class java_bytecode_parsert:public parsert
7979
if(index==0 || index>=constant_pool.size())
8080
{
8181
error() << "invalid constant pool index (" << index << ")" << eom;
82+
error() << "constant pool size: " << constant_pool.size() << eom;
8283
throw 0;
8384
}
8485

@@ -946,6 +947,12 @@ void java_bytecode_parsert::rmethod_attribute(methodt &method)
946947
{
947948
u2 start_pc=read_u2();
948949
u2 end_pc=read_u2();
950+
951+
INVARIANT(
952+
start_pc < end_pc,
953+
"The start_pc must be less than the end_pc as this is the range the "
954+
"exception is active");
955+
949956
u2 handler_pc=read_u2();
950957
u2 catch_type=read_u2();
951958
method.exception_table[e].start_pc=start_pc;

0 commit comments

Comments
 (0)