bson 4.8.2 → 4.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/ext/bson/bson-endian.h +1 -1
  4. data/ext/bson/bson-native.h +1 -1
  5. data/ext/bson/bytebuf.c +1 -1
  6. data/ext/bson/endian.c +1 -1
  7. data/ext/bson/init.c +1 -1
  8. data/ext/bson/read.c +67 -19
  9. data/ext/bson/util.c +1 -1
  10. data/ext/bson/write.c +1 -1
  11. data/lib/bson.rb +1 -1
  12. data/lib/bson/active_support.rb +1 -1
  13. data/lib/bson/array.rb +7 -2
  14. data/lib/bson/binary.rb +1 -1
  15. data/lib/bson/boolean.rb +9 -2
  16. data/lib/bson/code.rb +1 -1
  17. data/lib/bson/code_with_scope.rb +9 -2
  18. data/lib/bson/config.rb +1 -1
  19. data/lib/bson/date.rb +1 -1
  20. data/lib/bson/date_time.rb +1 -1
  21. data/lib/bson/decimal128.rb +1 -1
  22. data/lib/bson/decimal128/builder.rb +1 -1
  23. data/lib/bson/document.rb +1 -1
  24. data/lib/bson/environment.rb +2 -1
  25. data/lib/bson/error.rb +4 -0
  26. data/lib/bson/ext_json.rb +1 -1
  27. data/lib/bson/false_class.rb +1 -1
  28. data/lib/bson/float.rb +1 -1
  29. data/lib/bson/hash.rb +7 -2
  30. data/lib/bson/int32.rb +1 -1
  31. data/lib/bson/int64.rb +1 -1
  32. data/lib/bson/integer.rb +1 -1
  33. data/lib/bson/json.rb +1 -1
  34. data/lib/bson/max_key.rb +1 -1
  35. data/lib/bson/min_key.rb +1 -1
  36. data/lib/bson/nil_class.rb +1 -1
  37. data/lib/bson/object.rb +1 -1
  38. data/lib/bson/object_id.rb +1 -1
  39. data/lib/bson/open_struct.rb +1 -1
  40. data/lib/bson/regexp.rb +1 -1
  41. data/lib/bson/registry.rb +1 -1
  42. data/lib/bson/specialized.rb +1 -1
  43. data/lib/bson/string.rb +1 -1
  44. data/lib/bson/symbol.rb +1 -1
  45. data/lib/bson/time.rb +1 -1
  46. data/lib/bson/time_with_zone.rb +1 -1
  47. data/lib/bson/timestamp.rb +1 -1
  48. data/lib/bson/true_class.rb +1 -1
  49. data/lib/bson/undefined.rb +1 -1
  50. data/lib/bson/version.rb +2 -2
  51. data/spec/bson/array_spec.rb +1 -1
  52. data/spec/bson/binary_spec.rb +1 -1
  53. data/spec/bson/binary_uuid_spec.rb +1 -1
  54. data/spec/bson/boolean_spec.rb +1 -1
  55. data/spec/bson/code_spec.rb +1 -1
  56. data/spec/bson/code_with_scope_spec.rb +1 -1
  57. data/spec/bson/date_spec.rb +1 -1
  58. data/spec/bson/date_time_spec.rb +1 -1
  59. data/spec/bson/decimal128_spec.rb +1 -1
  60. data/spec/bson/document_spec.rb +1 -1
  61. data/spec/bson/false_class_spec.rb +1 -1
  62. data/spec/bson/float_spec.rb +1 -1
  63. data/spec/bson/hash_spec.rb +1 -1
  64. data/spec/bson/int32_spec.rb +1 -1
  65. data/spec/bson/int64_spec.rb +1 -1
  66. data/spec/bson/integer_spec.rb +1 -1
  67. data/spec/bson/json_spec.rb +1 -1
  68. data/spec/bson/max_key_spec.rb +1 -1
  69. data/spec/bson/min_key_spec.rb +1 -1
  70. data/spec/bson/nil_class_spec.rb +1 -1
  71. data/spec/bson/object_id_spec.rb +1 -1
  72. data/spec/bson/object_spec.rb +1 -1
  73. data/spec/bson/open_struct_spec.rb +1 -1
  74. data/spec/bson/regexp_spec.rb +1 -1
  75. data/spec/bson/registry_spec.rb +1 -1
  76. data/spec/bson/string_spec.rb +1 -1
  77. data/spec/bson/symbol_spec.rb +1 -1
  78. data/spec/bson/time_spec.rb +1 -1
  79. data/spec/bson/time_with_zone_spec.rb +1 -1
  80. data/spec/bson/timestamp_spec.rb +1 -1
  81. data/spec/bson/true_class_spec.rb +1 -1
  82. data/spec/bson/undefined_spec.rb +1 -1
  83. data/spec/bson_spec.rb +1 -1
  84. data/spec/runners/common_driver.rb +1 -1
  85. data/spec/runners/corpus.rb +13 -10
  86. data/spec/runners/corpus_legacy.rb +1 -1
  87. data/spec/spec_helper.rb +1 -1
  88. data/spec/spec_tests/data/corpus/top.json +0 -4
  89. data/spec/support/shared_examples.rb +1 -1
  90. metadata +92 -115
  91. checksums.yaml.gz.sig +0 -0
  92. data.tar.gz.sig +0 -0
  93. metadata.gz.sig +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e38ba3f134f5442df04b99f97b72d5804958bd0e67a0671120c68b8e478a6bbc
4
- data.tar.gz: aea2543db1c169057f384ee24b3823c7ecee63c50db026666e5a0ac3b657de02
3
+ metadata.gz: 05c17fcaee2ceaefe97d801594460178acaf6a2f82c152ce33db819f01d624fa
4
+ data.tar.gz: 3343dfda6f4038fa261d077ddf860dd43ff001d2fbea7189110b6fa500fb2558
5
5
  SHA512:
6
- metadata.gz: 4cb39ca20cec492ae47a8ec79135dac10bc9abbd3efcbd75463af6659a37450048160a7ee72015ed5c0c1f15252b3ce2d760d1a9ecaa36135b5335e3792ec211
7
- data.tar.gz: 981cb9b77564419678f14382ba5e63c8c55ad4ae8d500953a7b64bbc031614c1b235d76140e62573f806a0e37a680eaafd7e0699e57a41e810d028f8c74fee56
6
+ metadata.gz: 7756cee7923f3ca584e6a1bfa3666f70d2f14804b3ddb913f0695be3495a061a632803a90d1cd87a63c95d5b9222c02b18fe475a38e2a8a680914819f90f4471
7
+ data.tar.gz: 88bf0b45ecbe2aa47c955ca5281568cbe6d48a4c144a5b49680f6f7d8684fa61524dcc80474118c12e9df13b6bfc4ffca1a0d0e55679c0325dcdfd48543aab96
data/README.md CHANGED
@@ -38,7 +38,7 @@ As of 2.0.0, this project adheres to the
38
38
  License
39
39
  -------
40
40
 
41
- Copyright (C) 2009-2019 MongoDB Inc.
41
+ Copyright (C) 2009-2020 MongoDB Inc.
42
42
 
43
43
  Licensed under the Apache License, Version 2.0 (the "License");
44
44
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2015-2019 MongoDB, Inc.
2
+ * Copyright (C) 2015-2020 MongoDB Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2009-2019 MongoDB, Inc.
2
+ * Copyright (C) 2009-2020 MongoDB Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2009-2019 MongoDB, Inc.
2
+ * Copyright (C) 2009-2020 MongoDB Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2015-2019 MongoDB, Inc.
2
+ * Copyright (C) 2015-2020 MongoDB Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2009-2019 MongoDB Inc.
2
+ * Copyright (C) 2009-2020 MongoDB Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2009-2019 MongoDB, Inc.
2
+ * Copyright (C) 2009-2020 MongoDB Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -17,22 +17,28 @@
17
17
  #include "bson-native.h"
18
18
  #include <ruby/encoding.h>
19
19
 
20
- static void pvt_validate_length(byte_buffer_t *b);
20
+ static void pvt_raise_decode_error(volatile VALUE msg);
21
+ static int32_t pvt_validate_length(byte_buffer_t *b);
21
22
  static uint8_t pvt_get_type_byte(byte_buffer_t *b);
22
23
  static VALUE pvt_get_int32(byte_buffer_t *b);
23
24
  static VALUE pvt_get_int64(byte_buffer_t *b, int argc, VALUE *argv);
24
25
  static VALUE pvt_get_double(byte_buffer_t *b);
25
- static VALUE pvt_get_string(byte_buffer_t *b);
26
+ static VALUE pvt_get_string(byte_buffer_t *b, const char *data_type);
26
27
  static VALUE pvt_get_symbol(byte_buffer_t *b, VALUE rb_buffer, int argc, VALUE *argv);
27
28
  static VALUE pvt_get_boolean(byte_buffer_t *b);
28
29
  static VALUE pvt_read_field(byte_buffer_t *b, VALUE rb_buffer, uint8_t type, int argc, VALUE *argv);
29
30
  static void pvt_skip_cstring(byte_buffer_t *b);
30
31
 
32
+ void pvt_raise_decode_error(volatile VALUE msg) {
33
+ VALUE klass = pvt_const_get_3("BSON", "Error", "BSONDecodeError");
34
+ rb_exc_raise(rb_exc_new_str(klass, msg));
35
+ }
36
+
31
37
  /**
32
38
  * validate the buffer contains the amount of bytes the array / hash claimns
33
39
  * and that it is null terminated
34
40
  */
35
- void pvt_validate_length(byte_buffer_t *b)
41
+ int32_t pvt_validate_length(byte_buffer_t *b)
36
42
  {
37
43
  int32_t length;
38
44
 
@@ -53,6 +59,8 @@ void pvt_validate_length(byte_buffer_t *b)
53
59
  else{
54
60
  rb_raise(rb_eRangeError, "Buffer contained invalid length %d at %zu", length, b->read_position);
55
61
  }
62
+
63
+ return length;
56
64
  }
57
65
 
58
66
  /**
@@ -64,7 +72,7 @@ VALUE pvt_read_field(byte_buffer_t *b, VALUE rb_buffer, uint8_t type, int argc,
64
72
  case BSON_TYPE_INT32: return pvt_get_int32(b);
65
73
  case BSON_TYPE_INT64: return pvt_get_int64(b, argc, argv);
66
74
  case BSON_TYPE_DOUBLE: return pvt_get_double(b);
67
- case BSON_TYPE_STRING: return pvt_get_string(b);
75
+ case BSON_TYPE_STRING: return pvt_get_string(b, "String");
68
76
  case BSON_TYPE_SYMBOL: return pvt_get_symbol(b, rb_buffer, argc, argv);
69
77
  case BSON_TYPE_ARRAY: return rb_bson_byte_buffer_get_array(argc, argv, rb_buffer);
70
78
  case BSON_TYPE_DOCUMENT: return rb_bson_byte_buffer_get_hash(argc, argv, rb_buffer);
@@ -119,9 +127,20 @@ VALUE rb_bson_byte_buffer_get_bytes(VALUE self, VALUE i)
119
127
  }
120
128
 
121
129
  VALUE pvt_get_boolean(byte_buffer_t *b){
122
- VALUE result = Qnil;
130
+ VALUE result;
131
+ char byte_value;
123
132
  ENSURE_BSON_READ(b, 1);
124
- result = *READ_PTR(b) == 1 ? Qtrue: Qfalse;
133
+ byte_value = *READ_PTR(b);
134
+ switch (byte_value) {
135
+ case 1:
136
+ result = Qtrue;
137
+ break;
138
+ case 0:
139
+ result = Qfalse;
140
+ break;
141
+ default:
142
+ pvt_raise_decode_error(rb_sprintf("Invalid boolean byte value: %d", (int) byte_value));
143
+ }
125
144
  b->read_position += 1;
126
145
  return result;
127
146
  }
@@ -134,22 +153,35 @@ VALUE rb_bson_byte_buffer_get_string(VALUE self)
134
153
  byte_buffer_t *b;
135
154
 
136
155
  TypedData_Get_Struct(self, byte_buffer_t, &rb_byte_buffer_data_type, b);
137
- return pvt_get_string(b);
156
+ return pvt_get_string(b, "String");
138
157
  }
139
158
 
140
- VALUE pvt_get_string(byte_buffer_t *b)
159
+ VALUE pvt_get_string(byte_buffer_t *b, const char *data_type)
141
160
  {
142
- int32_t length;
143
161
  int32_t length_le;
162
+ int32_t length;
163
+ char *str_ptr;
144
164
  VALUE string;
165
+ unsigned char last_byte;
145
166
 
146
167
  ENSURE_BSON_READ(b, 4);
147
- memcpy(&length, READ_PTR(b), 4);
148
- length_le = BSON_UINT32_FROM_LE(length);
149
- b->read_position += 4;
150
- ENSURE_BSON_READ(b, length_le);
151
- string = rb_enc_str_new(READ_PTR(b), length_le - 1, rb_utf8_encoding());
152
- b->read_position += length_le;
168
+ memcpy(&length_le, READ_PTR(b), 4);
169
+ length = BSON_UINT32_FROM_LE(length_le);
170
+ if (length < 0) {
171
+ pvt_raise_decode_error(rb_sprintf("String length is negative: %d", length));
172
+ }
173
+ if (length == 0) {
174
+ pvt_raise_decode_error(rb_str_new_cstr("String length is zero but string must be null-terminated"));
175
+ }
176
+ ENSURE_BSON_READ(b, 4 + length);
177
+ str_ptr = READ_PTR(b) + 4;
178
+ last_byte = *(READ_PTR(b) + 4 + length_le - 1);
179
+ if (last_byte != 0) {
180
+ pvt_raise_decode_error(rb_sprintf("Last byte of the string is not null: 0x%x", (int) last_byte));
181
+ }
182
+ rb_bson_utf8_validate(str_ptr, length - 1, true, data_type);
183
+ string = rb_enc_str_new(str_ptr, length - 1, rb_utf8_encoding());
184
+ b->read_position += 4 + length_le;
153
185
  return string;
154
186
  }
155
187
 
@@ -166,7 +198,7 @@ VALUE pvt_get_symbol(byte_buffer_t *b, VALUE rb_buffer, int argc, VALUE *argv)
166
198
  VALUE value, klass;
167
199
 
168
200
  if (pvt_get_mode_option(argc, argv) == BSON_MODE_BSON) {
169
- value = pvt_get_string(b);
201
+ value = pvt_get_string(b, "Symbol");
170
202
  klass = pvt_const_get_3("BSON", "Symbol", "Raw");
171
203
  value = rb_funcall(klass, rb_intern("new"), 1, value);
172
204
  } else {
@@ -306,10 +338,13 @@ VALUE rb_bson_byte_buffer_get_hash(int argc, VALUE *argv, VALUE self){
306
338
  byte_buffer_t *b = NULL;
307
339
  uint8_t type;
308
340
  VALUE cDocument = pvt_const_get_2("BSON", "Document");
341
+ int32_t length;
342
+ char *start_ptr;
309
343
 
310
344
  TypedData_Get_Struct(self, byte_buffer_t, &rb_byte_buffer_data_type, b);
311
345
 
312
- pvt_validate_length(b);
346
+ start_ptr = READ_PTR(b);
347
+ length = pvt_validate_length(b);
313
348
 
314
349
  doc = rb_funcall(cDocument, rb_intern("allocate"), 0);
315
350
 
@@ -318,6 +353,11 @@ VALUE rb_bson_byte_buffer_get_hash(int argc, VALUE *argv, VALUE self){
318
353
  rb_hash_aset(doc, field, pvt_read_field(b, self, type, argc, argv));
319
354
  RB_GC_GUARD(field);
320
355
  }
356
+
357
+ if (READ_PTR(b) - start_ptr != length) {
358
+ pvt_raise_decode_error(rb_sprintf("Expected to read %d bytes for the hash but read %ld bytes", length, READ_PTR(b) - start_ptr));
359
+ }
360
+
321
361
  return doc;
322
362
  }
323
363
 
@@ -325,10 +365,13 @@ VALUE rb_bson_byte_buffer_get_array(int argc, VALUE *argv, VALUE self){
325
365
  byte_buffer_t *b;
326
366
  VALUE array = Qnil;
327
367
  uint8_t type;
368
+ int32_t length;
369
+ char *start_ptr;
328
370
 
329
371
  TypedData_Get_Struct(self, byte_buffer_t, &rb_byte_buffer_data_type, b);
330
372
 
331
- pvt_validate_length(b);
373
+ start_ptr = READ_PTR(b);
374
+ length = pvt_validate_length(b);
332
375
 
333
376
  array = rb_ary_new();
334
377
  while((type = pvt_get_type_byte(b)) != 0){
@@ -336,5 +379,10 @@ VALUE rb_bson_byte_buffer_get_array(int argc, VALUE *argv, VALUE self){
336
379
  rb_ary_push(array, pvt_read_field(b, self, type, argc, argv));
337
380
  }
338
381
  RB_GC_GUARD(array);
382
+
383
+ if (READ_PTR(b) - start_ptr != length) {
384
+ pvt_raise_decode_error(rb_sprintf("Expected to read %d bytes for the hash but read %ld bytes", length, READ_PTR(b) - start_ptr));
385
+ }
386
+
339
387
  return array;
340
388
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2009-2019 MongoDB, Inc.
2
+ * Copyright (C) 2009-2020 MongoDB Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2009-2019 MongoDB, Inc.
2
+ * Copyright (C) 2009-2020 MongoDB Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2018-2019 MongoDB Inc.
1
+ # Copyright (C) 2018-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -119,7 +119,8 @@ module BSON
119
119
  buffer.get_array(**options)
120
120
  else
121
121
  array = new
122
- buffer.get_int32 # throw away the length
122
+ start_position = buffer.read_position
123
+ expected_byte_size = buffer.get_int32
123
124
  while (type = buffer.get_byte) != NULL_BYTE
124
125
  buffer.get_cstring
125
126
  cls = BSON::Registry.get(type)
@@ -130,6 +131,10 @@ module BSON
130
131
  end
131
132
  array << value
132
133
  end
134
+ actual_byte_size = buffer.read_position - start_position
135
+ if actual_byte_size != expected_byte_size
136
+ raise Error::BSONDecodeError, "Expected array to take #{expected_byte_size} bytes but it took #{actual_byte_size} bytes"
137
+ end
133
138
  array
134
139
  end
135
140
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -39,7 +39,14 @@ module BSON
39
39
  #
40
40
  # @since 2.0.0
41
41
  def self.from_bson(buffer, **options)
42
- buffer.get_byte == TrueClass::TRUE_BYTE
42
+ case v = buffer.get_byte
43
+ when TrueClass::TRUE_BYTE
44
+ true
45
+ when FalseClass::FALSE_BYTE
46
+ false
47
+ else
48
+ raise Error::BSONDecodeError, "Invalid boolean byte value: #{v}"
49
+ end
43
50
  end
44
51
 
45
52
  # Register this type when the module is loaded.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -119,13 +119,20 @@ module BSON
119
119
  #
120
120
  # @since 2.0.0
121
121
  def self.from_bson(buffer, **options)
122
- buffer.get_int32 # Throw away the total length.
122
+ # Code with scope has a length (?) field which is not needed for
123
+ # decoding, but spec tests want this field validated.
124
+ start_position = buffer.read_position
125
+ length = buffer.get_int32
123
126
  javascript = buffer.get_string
124
127
  scope = if options.empty?
125
128
  ::Hash.from_bson(buffer)
126
129
  else
127
130
  ::Hash.from_bson(buffer, **options)
128
131
  end
132
+ read_bytes = buffer.read_position - start_position
133
+ if read_bytes != length
134
+ raise Error::BSONDecodeError, "CodeWithScope invalid: claimed length #{length}, actual length #{read_bytes}"
135
+ end
129
136
  new(javascript, scope)
130
137
  end
131
138
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016-2019 MongoDB Inc.
1
+ # Copyright (C) 2016-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016-2019 MongoDB Inc.
1
+ # Copyright (C) 2016-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016-2019 MongoDB Inc.
1
+ # Copyright (C) 2016-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -41,6 +41,7 @@ module BSON
41
41
  # @return [ true, false ] If the Ruby version is 1.9.
42
42
  #
43
43
  # @since 4.2.0
44
+ # @deprecated
44
45
  def ruby_1_9?
45
46
  @ruby_1_9 ||= RUBY_VERSION < '2.0.0'
46
47
  end
@@ -13,5 +13,9 @@ module BSON
13
13
  # unsupported binary subtype.
14
14
  class UnsupportedBinarySubtype < Error
15
15
  end
16
+
17
+ # Exception raised when BSON decoding fails.
18
+ class BSONDecodeError < Error
19
+ end
16
20
  end
17
21
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2019 MongoDB Inc.
1
+ # Copyright (C) 2019-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2019 MongoDB Inc.
1
+ # Copyright (C) 2009-2020 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.