ruby-macho 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/macho/file.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce4c78f7559d54d07390f535cfe67da8b747ca9d
|
4
|
+
data.tar.gz: 5e1da197dae79a1d084781898e01c5576704b54e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5534f18bf42c95de58c33abb7a98521496cc1258a99049784a1030d145efaaf59755575db792eab1ad714da02a003eebee0c97c9f7c8f301df12b794fabb4c48
|
7
|
+
data.tar.gz: e5f681c4c01f9105dfcb087d36d74870ea0fbef69336bfd5286ab8787d7e1c2555c049699510c38fa42c6ccb1bb876cbe177e3db7ebfec86334824721a7199e0
|
data/lib/macho/file.rb
CHANGED
@@ -103,7 +103,7 @@ module MachO
|
|
103
103
|
|
104
104
|
dylib_id = @raw_data.slice(offset + stroffset...offset + cmdsize).unpack("Z*").first
|
105
105
|
|
106
|
-
dylib_id
|
106
|
+
dylib_id.delete("\x00")
|
107
107
|
end
|
108
108
|
|
109
109
|
def dylib_id=(new_id)
|
@@ -124,6 +124,7 @@ module MachO
|
|
124
124
|
new_sizeofcmds = header[:sizeofcmds]
|
125
125
|
dylib_id_cmd = command('LC_ID_DYLIB').first
|
126
126
|
old_id = dylib_id
|
127
|
+
new_id = new_id.dup
|
127
128
|
|
128
129
|
new_pad = Utils.round(new_id.size, cmd_round) - new_id.size
|
129
130
|
old_pad = Utils.round(old_id.size, cmd_round) - old_id.size
|
@@ -161,7 +162,7 @@ module MachO
|
|
161
162
|
@raw_data[dylib_id_cmd.offset + 4, 4] = [new_size].pack("V")
|
162
163
|
|
163
164
|
# delete the old id
|
164
|
-
@raw_data.slice!(dylib_id_cmd.offset + dylib_id_cmd.name...dylib_id_cmd.offset + dylib_id_cmd.
|
165
|
+
@raw_data.slice!(dylib_id_cmd.offset + dylib_id_cmd.name...dylib_id_cmd.offset + dylib_id_cmd.class.bytesize + old_id.size)
|
165
166
|
|
166
167
|
# insert the new id
|
167
168
|
@raw_data.insert(dylib_id_cmd.offset + dylib_id_cmd.name, new_id)
|