Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CodeHawk/CHB/bchlib/bCHVersion.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ end


let version = new version_info_t
~version:"0.6.0_20260122"
~date:"2026-01-22"
~version:"0.6.0_20260225"
~date:"2026-02-25"
~licensee: None
~maxfilesize: None
()
10 changes: 8 additions & 2 deletions CodeHawk/CHB/bchlibelf/bCHELFHeader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Copyright (c) 2005-2020 Kestrel Technology LLC
Copyright (c) 2020 Henny Sipma
Copyright (c) 2021-2025 Aarno Labs LLC
Copyright (c) 2021-2026 Aarno Labs LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -808,12 +808,18 @@ object(self)
match self#get_containing_section a with
| Some s ->
let diff = a#subtract_to_int s#get_vaddr in
(* In some cases the <= check may be problematic. If the section is the
last one in the file, or perhaps if there is a gap between this
section and the next, the check may succeed, but the retrieval of
the corresponding bytes may fail. However, a < check may result in
missing the last library stub in a plt section.*)
if Result.is_ok diff then
(TR.tget_ok diff) + size < s#get_size
(TR.tget_ok diff) + size <= s#get_size
else
raise
(BCH_failure
(LBLOCK [
STR __FILE__; STR ":"; INT __LINE__;
STR "ELFHeader:has_xsubstring: interal error: ";
STR "subtraction"]))
| _ -> false
Expand Down
22 changes: 21 additions & 1 deletion CodeHawk/CHB/bchlibelf/bCHELFTypes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Copyright (c) 2005-2020 Kestrel Technology LLC
Copyright (c) 2020 Henny Sipma
Copyright (c) 2021-2024 Aarno Labs LLC
Copyright (c) 2021-2026 Aarno Labs LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -807,6 +807,11 @@ object
method get_executable_sections: (elf_section_header_int * string) list
method get_executable_segments: (elf_program_header_int * string) list
method get_string_at_address: doubleword_int -> string option

(** [get_xsubstring addr size] returns the string of bytes starting at
virtual address [addr] with length size bytes.
Note: see comment for has_xsubstring below
*)
method get_xsubstring: doubleword_int -> int -> string
method get_relocation: doubleword_int -> string option
method get_containing_section: doubleword_int -> elf_raw_section_int option
Expand All @@ -832,6 +837,21 @@ object

method is_uninitialized_data_address: doubleword_int -> bool
method is_global_offset_table_address: doubleword_int -> bool

(** [has_xsubstring addr size] returns true if the section that contains
virtual address [addr] has at least [size] bytes starting from address
[addr].

Note: the check performed is
[addr - section_start_address) + size <= section_size]
In some cases the less than equal check may be problematic: if the
section is the last section of the file, or perhaps if there is a
gap between this section and the next, the equal sign may make the
check succeed, but the retrieval of the corresponding bytes, by calling
[get_xsubstring] with the same arguments, may fail.
However, if a less-than check is used the last library stub in a plt
may be missed.
*)
method has_xsubstring: doubleword_int -> int -> bool
method has_debug_info: bool
method has_debug_abbrev: bool
Expand Down