Skip to content

Commit

Permalink
make tls callbacks an array instead of null
Browse files Browse the repository at this point in the history
  • Loading branch information
LordNoteworthy committed Feb 10, 2024
1 parent a74ca42 commit 489f394
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ type ImageRuntimeFunctionEntry struct {
type ImageARMRuntimeFunctionEntry struct {
// Function Start RVA is the 32-bit RVA of the start of the function. If
// the function contains thumb code, the low bit of this address must be set.
BeginAddress uint32 `bitfield:",functionstart"`
BeginAddress uint32 `bitfield:",functionstart" json:"begin_address"`

// Flag is a 2-bit field that indicates how to interpret the remaining
// 30 bits of the second .pdata word. If Flag is 0, then the remaining bits
// form an Exception Information RVA (with the low two bits implicitly 0).
// If Flag is non-zero, then the remaining bits form a Packed Unwind Data
// structure.
Flag uint8
Flag uint8 `json:"flag"`

/* Exception Information RVA or Packed Unwind Data.
Expand All @@ -211,7 +211,7 @@ type ImageARMRuntimeFunctionEntry struct {
Packed Unwind Data is a compressed description of the operations required
to unwind from a function, assuming a canonical form. In this case, no
.xdata record is required. */
ExceptionFlag uint32
ExceptionFlag uint32 `json:"exception_flag"`
}

// UnwindCode is used to record the sequence of operations in the prolog that
Expand Down
4 changes: 2 additions & 2 deletions tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (pe *File) parseTLSDirectory(rva, size uint32) error {
tls.Struct = tlsDir

if tlsDir.AddressOfCallBacks != 0 {
var callbacks []uint64
callbacks := make([]uint64, 0)
rvaAddressOfCallBacks := uint32(tlsDir.AddressOfCallBacks -
pe.NtHeader.OptionalHeader.(ImageOptionalHeader64).ImageBase)
offset := pe.GetOffsetFromRva(rvaAddressOfCallBacks)
Expand All @@ -138,7 +138,7 @@ func (pe *File) parseTLSDirectory(rva, size uint32) error {
// 94a9dc17d47b03f6fb01cb639e25503b37761b452e7c07ec6b6c2280635f1df9
// Callbacks may be empty.
if tlsDir.AddressOfCallBacks != 0 {
var callbacks []uint32
callbacks := make([]uint32, 0)
rvaAddressOfCallBacks := tlsDir.AddressOfCallBacks -
pe.NtHeader.OptionalHeader.(ImageOptionalHeader32).ImageBase
offset := pe.GetOffsetFromRva(rvaAddressOfCallBacks)
Expand Down

0 comments on commit 489f394

Please sign in to comment.