bindata 2.4.7 → 2.4.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bindata might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9be5b49e663e2525dfc786351b811954d2069d17796271f39dd2e6023b42b25b
4
- data.tar.gz: d3f43e1edb07968d56ad0ae8afb6db509ac234670cd5695a8e6f3ea4ef1f24f0
3
+ metadata.gz: 930073ad9a50e67aa2d584a17c0138f3cb4008e4bd96851ceef305e16c7cadd2
4
+ data.tar.gz: ec59bb6fcff33192da1ee33952c69e1069c214c0f41f9b21786694ed7fa4c87c
5
5
  SHA512:
6
- metadata.gz: 19f3a5d4f957c8136048df08132f3db8445e85c5cf894f046840724ff712ee656ecd1c0c40e962a90d00deae2af901b9aae7909e99ad68c91e9d1d133ead29dd
7
- data.tar.gz: 162b363f3618ba5f89bdd5f8018e948d726ae52e153339fbd8071c9aefeedbd3a88146a987424871799949033047e02658eee8c0671bc17e5f9f0d8b9af3e9ae
6
+ metadata.gz: c2ebc4a2e56294d7b503d73cfee08fa165c37b96a4216e6ac17206b2566d3b5ea77adb188b819a8e63bf1a059ab79d068d1def5059d7b2b6811609f099a3656f
7
+ data.tar.gz: 96c38802d6197001dfbfb76a4a338bcc7dbf2e8f7ec685b5007cdc6a8917b502ad8bc1ca106323a52f3555cada27f1b90ba204a5c72253447983026af020c27f
@@ -1,5 +1,10 @@
1
1
  = BinData Changelog
2
2
 
3
+ == Version 2.4.8 (2020-07-21)
4
+
5
+ * Bug fix array self assignment. Thanks to Spencer McIntyre.
6
+ * Bug fix Stringz max_length. Thanks to cdelafuente-r7.
7
+
3
8
  == Version 2.4.7 (2020-03-31)
4
9
 
5
10
  * Fix choice assignment inside arrays. Reported by Spencer McIntyre.
@@ -80,6 +80,7 @@ module BinData
80
80
  end
81
81
 
82
82
  def assign(array)
83
+ return if self.equal?(array) # prevent self assignment
83
84
  raise ArgumentError, "can't set a nil value for #{debug_name}" if array.nil?
84
85
 
85
86
  @element_list = []
@@ -80,7 +80,7 @@ module BinData
80
80
  def trim_to!(str, max_length = nil)
81
81
  if max_length
82
82
  max_length = 1 if max_length < 1
83
- str.slice!(max_length)
83
+ str.slice!(max_length..-1)
84
84
  if str.length == max_length && str[-1, 1] != "\0"
85
85
  str[-1, 1] = "\0"
86
86
  end
@@ -1,3 +1,3 @@
1
1
  module BinData
2
- VERSION = "2.4.7"
2
+ VERSION = "2.4.8"
3
3
  end
@@ -266,6 +266,11 @@ describe BinData::Array, "when accessing elements" do
266
266
  lambda { obj["a"] }.must_raise TypeError
267
267
  lambda { obj[1, "a"] }.must_raise TypeError
268
268
  end
269
+
270
+ it "is unaffected by self assignment" do
271
+ obj.assign(obj)
272
+ obj.snapshot.must_equal [1, 2, 3, 4, 5]
273
+ end
269
274
  end
270
275
 
271
276
  describe BinData::Array, "with :read_until" do
@@ -106,12 +106,12 @@ describe BinData::Stringz, "with max_length" do
106
106
  end
107
107
 
108
108
  it "trims values greater than max_length" do
109
- obj.assign("abcde")
109
+ obj.assign("abcdefg")
110
110
  obj.must_equal "abcd"
111
111
  end
112
112
 
113
113
  it "writes values greater than max_length" do
114
- obj.assign("abcde")
114
+ obj.assign("abcdefg")
115
115
  obj.to_binary_s.must_equal_binary "abcd\0"
116
116
  end
117
117
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bindata
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.7
4
+ version: 2.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dion Mendel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-30 00:00:00.000000000 Z
11
+ date: 2020-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake