ilios 1.0.5 → 1.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 119d5f16f005dbc317d42110162895ac90b7acc12fad39b4c2b33d04587ceeb9
4
- data.tar.gz: d2b9caed7e97e5592737654171e6a06dea5cdecf872f5827b2547c6c4a704dc4
3
+ metadata.gz: ae1db76d702cb217eb8145f498dd86044183e441cbd896ac6acfd0d118823d13
4
+ data.tar.gz: 5e5e141d2578bdfd5c2b39b8b7e5b72e5a65de824a4e5868c3388e3308973d8c
5
5
  SHA512:
6
- metadata.gz: 291ee870b21e87e4d33056f4f5a08c513904cb967786115a3d618bfd61943f561d31744b3554b87f069dcc59d308c52366788561d15d8ae7266f83cb1b865d65
7
- data.tar.gz: a3517d6c2d4f746dd66234e02a96b084069128442ddab5ad2044995fcb5418bbebbdc7f6d2d0b5dc9eeefe654646c7a42af36ffd607aa40dd8208726d3c8cb36
6
+ metadata.gz: 2c78135d42da8f1c532c80531d0a493fed7f4bcf96ddf2d8aabdafac649740cb819a6f038640031993fe33fdc82c245e9725868f71149751aaaadf9ca3710d0b
7
+ data.tar.gz: 26771b46cf175596fdd14a19873783c151f3a1b02798ca43fa39b7828b8519a3316bbcafbc93a291d9c44cadb95d562c1e7fc6d30b19e48e2efb28592c72c674
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.0.6
4
+
5
+ - Fix uninitialized memory being returned for an undecodable column value (#27)
6
+ - Fix segmentation fault when a Result is used after Result#next_page fails (#26)
7
+ - Fix uninitialized memory being bound for a malformed UUID string (#25)
8
+
3
9
  ## 1.0.5
4
10
 
5
11
  - Fix use-after-free when re-binding a statement with in-flight async executions (#24)
data/ext/ilios/result.c CHANGED
@@ -45,6 +45,7 @@ static VALUE result_next_page(VALUE self)
45
45
  CassandraStatement *cassandra_statement;
46
46
  CassandraSession *cassandra_session;
47
47
  CassFuture *result_future;
48
+ CassError error_code;
48
49
 
49
50
  GET_RESULT(self, cassandra_result);
50
51
 
@@ -61,18 +62,31 @@ static VALUE result_next_page(VALUE self)
61
62
  cass_statement_set_paging_state(cassandra_result->executed_statement, cassandra_result->result);
62
63
 
63
64
  result_future = nogvl_session_execute(cassandra_session->session, cassandra_result->executed_statement);
65
+ nogvl_future_wait(result_future);
66
+
67
+ error_code = cass_future_error_code(result_future);
68
+ if (error_code != CASS_OK) {
69
+ cass_future_free(result_future);
70
+ rb_raise(eExecutionError, "Unable to wait executing: %s", cass_error_desc(error_code));
71
+ }
64
72
 
65
73
  cass_result_free(cassandra_result->result);
66
74
  if (cassandra_result->future) {
67
75
  cass_future_free(cassandra_result->future);
68
76
  }
69
- cassandra_result->result = NULL;
77
+ cassandra_result->result = cass_future_get_result(result_future);
70
78
  cassandra_result->future = result_future;
71
79
 
72
- result_await(cassandra_result);
73
80
  return self;
74
81
  }
75
82
 
83
+ static void result_check_value(CassError error_code, VALUE key)
84
+ {
85
+ if (error_code != CASS_OK) {
86
+ rb_raise(eExecutionError, "Unable to get value of %"PRIsVALUE" column: %s", key, cass_error_desc(error_code));
87
+ }
88
+ }
89
+
76
90
  static VALUE result_convert_row(const CassResult *result, const CassRow *row, size_t column_count)
77
91
  {
78
92
  VALUE key;
@@ -95,56 +109,56 @@ static VALUE result_convert_row(const CassResult *result, const CassRow *row, si
95
109
  switch (type) {
96
110
  case CASS_VALUE_TYPE_TINY_INT:
97
111
  {
98
- cass_int8_t output;
99
- cass_value_get_int8(value, &output);
112
+ cass_int8_t output = 0;
113
+ result_check_value(cass_value_get_int8(value, &output), key);
100
114
  rb_hash_aset(hash, key, INT2NUM(output));
101
115
  }
102
116
  break;
103
117
 
104
118
  case CASS_VALUE_TYPE_SMALL_INT:
105
119
  {
106
- cass_int16_t output;
107
- cass_value_get_int16(value, &output);
120
+ cass_int16_t output = 0;
121
+ result_check_value(cass_value_get_int16(value, &output), key);
108
122
  rb_hash_aset(hash, key, INT2NUM(output));
109
123
  }
110
124
  break;
111
125
 
112
126
  case CASS_VALUE_TYPE_INT:
113
127
  {
114
- cass_int32_t output;
115
- cass_value_get_int32(value, &output);
128
+ cass_int32_t output = 0;
129
+ result_check_value(cass_value_get_int32(value, &output), key);
116
130
  rb_hash_aset(hash, key, INT2NUM(output));
117
131
  }
118
132
  break;
119
133
 
120
134
  case CASS_VALUE_TYPE_BIGINT:
121
135
  {
122
- cass_int64_t output;
123
- cass_value_get_int64(value, &output);
136
+ cass_int64_t output = 0;
137
+ result_check_value(cass_value_get_int64(value, &output), key);
124
138
  rb_hash_aset(hash, key, LL2NUM(output));
125
139
  }
126
140
  break;
127
141
 
128
142
  case CASS_VALUE_TYPE_FLOAT:
129
143
  {
130
- cass_float_t output;
131
- cass_value_get_float(value, &output);
144
+ cass_float_t output = 0;
145
+ result_check_value(cass_value_get_float(value, &output), key);
132
146
  rb_hash_aset(hash, key, DBL2NUM(output));
133
147
  }
134
148
  break;
135
149
 
136
150
  case CASS_VALUE_TYPE_DOUBLE:
137
151
  {
138
- cass_double_t output;
139
- cass_value_get_double(value, &output);
152
+ cass_double_t output = 0;
153
+ result_check_value(cass_value_get_double(value, &output), key);
140
154
  rb_hash_aset(hash, key, DBL2NUM(output));
141
155
  }
142
156
  break;
143
157
 
144
158
  case CASS_VALUE_TYPE_BOOLEAN:
145
159
  {
146
- cass_bool_t output;
147
- cass_value_get_bool(value, &output);
160
+ cass_bool_t output = cass_false;
161
+ result_check_value(cass_value_get_bool(value, &output), key);
148
162
  rb_hash_aset(hash, key, output == cass_true ? Qtrue : Qfalse);
149
163
  }
150
164
  break;
@@ -153,26 +167,26 @@ static VALUE result_convert_row(const CassResult *result, const CassRow *row, si
153
167
  case CASS_VALUE_TYPE_ASCII:
154
168
  case CASS_VALUE_TYPE_VARCHAR:
155
169
  {
156
- const char* s;
157
- size_t s_length;
158
- cass_value_get_string(value, &s, &s_length);
170
+ const char* s = NULL;
171
+ size_t s_length = 0;
172
+ result_check_value(cass_value_get_string(value, &s, &s_length), key);
159
173
  rb_hash_aset(hash, key, rb_str_new(s, s_length));
160
174
  }
161
175
  break;
162
176
 
163
177
  case CASS_VALUE_TYPE_TIMESTAMP:
164
178
  {
165
- cass_int64_t output;
166
- cass_value_get_int64(value, &output);
179
+ cass_int64_t output = 0;
180
+ result_check_value(cass_value_get_int64(value, &output), key);
167
181
  rb_hash_aset(hash, key, rb_time_new(output / 1000, output % 1000 * 1000));
168
182
  }
169
183
  break;
170
184
 
171
185
  case CASS_VALUE_TYPE_UUID:
172
186
  {
173
- CassUuid output;
187
+ CassUuid output = { 0, 0 };
174
188
  char uuid[40];
175
- cass_value_get_uuid(value, &output);
189
+ result_check_value(cass_value_get_uuid(value, &output), key);
176
190
  cass_uuid_string(output, uuid);
177
191
  rb_hash_aset(hash, key, rb_str_new2(uuid));
178
192
  }
@@ -138,10 +138,14 @@ static int hash_cb(VALUE key, VALUE value, VALUE arg)
138
138
 
139
139
  case CASS_VALUE_TYPE_UUID:
140
140
  {
141
- CassUuid uuid;
141
+ CassUuid uuid = { 0, 0 };
142
142
  const char *uuid_string = StringValueCStr(value);
143
143
 
144
- cass_uuid_from_string(uuid_string, &uuid);
144
+ result = cass_uuid_from_string(uuid_string, &uuid);
145
+ if (result != CASS_OK) {
146
+ rb_raise(eStatementError, "Invalid UUID was given: %s=%"PRIsVALUE"", name, value);
147
+ }
148
+
145
149
  result = cass_statement_bind_uuid_by_name(ctx->statement, name, uuid);
146
150
  }
147
151
  break;
data/lib/ilios/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ilios
4
- VERSION = '1.0.5'
4
+ VERSION = '1.0.6'
5
5
  public_constant :VERSION
6
6
 
7
7
  CASSANDRA_CPP_DRIVER_VERSION = '2.17.1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ilios
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watson
@@ -58,7 +58,7 @@ metadata:
58
58
  homepage_uri: https://github.com/Watson1978/ilios
59
59
  source_code_uri: https://github.com/Watson1978/ilios
60
60
  bug_tracker_uri: https://github.com/Watson1978/ilios/issues
61
- documentation_uri: https://www.rubydoc.info/gems/ilios/1.0.5
61
+ documentation_uri: https://www.rubydoc.info/gems/ilios/1.0.6
62
62
  rubygems_mfa_required: 'true'
63
63
  rdoc_options: []
64
64
  require_paths:
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  requirements:
77
77
  - cmake
78
- rubygems_version: 4.0.15
78
+ rubygems_version: 4.0.16
79
79
  specification_version: 4
80
80
  summary: Cassandra driver written by C language
81
81
  test_files: []