Land #5139, metasm/ruby signedness fix

bug/bundler_fix
Tod Beardsley 2015-04-14 10:26:23 -05:00
commit 97e715b1ce
No known key found for this signature in database
GPG Key ID: BD63D0A3EA19CAAC
1 changed files with 2 additions and 2 deletions

View File

@ -306,8 +306,8 @@ class ExeFormat
# creates a new label, that is guaranteed to never be returned again as long as this object (ExeFormat) exists
def new_label(base = '')
base = base.dup.tr('^a-zA-Z0-9_', '_')
# use %x instead of to_s(16) for negative values
base = (base << '_uuid' << ('%08x' % base.object_id)).freeze if base.empty? or @unique_labels_cache[base]
# use %x with absolute value to avoid negative number formatting
base = (base << '_uuid' << ('%08x' % base.object_id.abs)).freeze if base.empty? or @unique_labels_cache[base]
@unique_labels_cache[base] = true
base
end