Skip to content

Commit 97e715b

Browse files
author
Tod Beardsley
committed
Land rapid7#5139, metasm/ruby signedness fix
2 parents f628599 + 3860bba commit 97e715b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/metasm/metasm/main.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ def label_at(edata, offset, base = '')
306306
# creates a new label, that is guaranteed to never be returned again as long as this object (ExeFormat) exists
307307
def new_label(base = '')
308308
base = base.dup.tr('^a-zA-Z0-9_', '_')
309-
# use %x instead of to_s(16) for negative values
310-
base = (base << '_uuid' << ('%08x' % base.object_id)).freeze if base.empty? or @unique_labels_cache[base]
309+
# use %x with absolute value to avoid negative number formatting
310+
base = (base << '_uuid' << ('%08x' % base.object_id.abs)).freeze if base.empty? or @unique_labels_cache[base]
311311
@unique_labels_cache[base] = true
312312
base
313313
end

0 commit comments

Comments
 (0)