Merge lp:~wiml/libdrizzle/integer-sizes into lp:libdrizzle
- integer-sizes
- Merge into libdrizzle-redux
Proposed by
Wim Lewis
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Andrew Hutchings | ||||||||
Approved revision: | 121 | ||||||||
Merged at revision: | 109 | ||||||||
Proposed branch: | lp:~wiml/libdrizzle/integer-sizes | ||||||||
Merge into: | lp:libdrizzle | ||||||||
Diff against target: |
618 lines (+134/-80) 14 files modified
libdrizzle-5.1/constants.h (+15/-21) libdrizzle-5.1/field_client.h (+17/-2) libdrizzle/binlog.cc (+5/-5) libdrizzle/conn.cc (+6/-0) libdrizzle/field.cc (+36/-18) libdrizzle/handshake.cc (+2/-2) libdrizzle/pack.cc (+19/-7) libdrizzle/pack.h (+2/-1) libdrizzle/result.cc (+10/-8) libdrizzle/result.h (+6/-6) libdrizzle/statement.cc (+1/-1) libdrizzle/statement_param.cc (+8/-2) libdrizzle/structs.h (+6/-6) tests/unit/statement.c (+1/-1) |
||||||||
To merge this branch: | bzr merge lp:~wiml/libdrizzle/integer-sizes | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Hutchings | Approve | ||
Review via email: mp+152963@code.launchpad.net |
Commit message
Adjusting the sizes of integer variables to avoid truncation or overflow; also fixed some errors reading large responses or prepared-statement responses.
Description of the change
This is the result of examining libdrizzle for integer truncation and overflow problems. A few other small bugs were found and fixed along the way--- see the individual commit messages for these.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'libdrizzle-5.1/constants.h' | |||
2 | --- libdrizzle-5.1/constants.h 2013-01-28 01:04:53 +0000 | |||
3 | +++ libdrizzle-5.1/constants.h 2013-03-12 16:48:27 +0000 | |||
4 | @@ -604,27 +604,21 @@ | |||
5 | 604 | */ | 604 | */ |
6 | 605 | 605 | ||
7 | 606 | /* Protocol unpacking macros. */ | 606 | /* Protocol unpacking macros. */ |
29 | 607 | #define drizzle_get_byte2(__buffer) \ | 607 | #define drizzle_get_byte2(__buffer) \ |
30 | 608 | (uint16_t)((__buffer)[0] | \ | 608 | ((((uint8_t *)__buffer)[0]) | \ |
31 | 609 | ((__buffer)[1] << 8)) | 609 | ((uint16_t)(((uint8_t *)__buffer)[1]) << 8)) |
32 | 610 | #define drizzle_get_byte3(__buffer) \ | 610 | #define drizzle_get_byte3(__buffer) \ |
33 | 611 | (uint32_t)((__buffer)[0] | \ | 611 | (((uint8_t *)__buffer)[0] | \ |
34 | 612 | ((__buffer)[1] << 8) | \ | 612 | ((uint32_t)(((uint8_t *)__buffer)[1]) << 8) | \ |
35 | 613 | ((__buffer)[2] << 16)) | 613 | ((uint32_t)(((uint8_t *)__buffer)[2]) << 16)) |
36 | 614 | #define drizzle_get_byte4(__buffer) \ | 614 | #define drizzle_get_byte4(__buffer) \ |
37 | 615 | (uint32_t)((__buffer)[0] | \ | 615 | (((uint8_t *)__buffer)[0] | \ |
38 | 616 | ((__buffer)[1] << 8) | \ | 616 | ((uint32_t)(((uint8_t *)__buffer)[1]) << 8) | \ |
39 | 617 | ((__buffer)[2] << 16) | \ | 617 | ((uint32_t)(((uint8_t *)__buffer)[2]) << 16) | \ |
40 | 618 | ((__buffer)[3] << 24)) | 618 | ((uint32_t)(((uint8_t *)__buffer)[3]) << 24)) |
41 | 619 | #define drizzle_get_byte8(__buffer) \ | 619 | #define drizzle_get_byte8(__buffer) \ |
42 | 620 | ((uint64_t)(__buffer)[0] | \ | 620 | (drizzle_get_byte4(__buffer) | \ |
43 | 621 | ((uint64_t)(__buffer)[1] << 8) | \ | 621 | ((uint64_t)drizzle_get_byte4(((uint8_t *)__buffer)+4) << 32)) |
23 | 622 | ((uint64_t)(__buffer)[2] << 16) | \ | ||
24 | 623 | ((uint64_t)(__buffer)[3] << 24) | \ | ||
25 | 624 | ((uint64_t)(__buffer)[4] << 32) | \ | ||
26 | 625 | ((uint64_t)(__buffer)[5] << 40) | \ | ||
27 | 626 | ((uint64_t)(__buffer)[6] << 48) | \ | ||
28 | 627 | ((uint64_t)(__buffer)[7] << 56)) | ||
44 | 628 | 622 | ||
45 | 629 | /* Protocol packing macros. */ | 623 | /* Protocol packing macros. */ |
46 | 630 | #define drizzle_set_byte2(__buffer, __int) do { \ | 624 | #define drizzle_set_byte2(__buffer, __int) do { \ |
47 | 631 | 625 | ||
48 | === modified file 'libdrizzle-5.1/field_client.h' | |||
49 | --- libdrizzle-5.1/field_client.h 2013-01-27 11:55:48 +0000 | |||
50 | +++ libdrizzle-5.1/field_client.h 2013-03-12 16:48:27 +0000 | |||
51 | @@ -60,14 +60,29 @@ | |||
52 | 60 | * Read field for unbuffered result, possibly in parts. This is especially | 60 | * Read field for unbuffered result, possibly in parts. This is especially |
53 | 61 | * useful for blob streaming, since the client does not need to buffer the | 61 | * useful for blob streaming, since the client does not need to buffer the |
54 | 62 | * entire blob. | 62 | * entire blob. |
55 | 63 | * | ||
56 | 64 | * The return value is a pointer into a buffer internal to \a result and should | ||
57 | 65 | * not be freed. It is valid only until the next call to a drizzle function for this | ||
58 | 66 | * connection. | ||
59 | 67 | * | ||
60 | 68 | * @returns A pointer to \a size bytes of field data. | ||
61 | 69 | * @param[in,out] result The result handle for the response being read. | ||
62 | 70 | * @param[out] offset The offset within the field of the data that was read. | ||
63 | 71 | * @param[out] size The number of bytes returned. | ||
64 | 72 | * @param[out] total The total size of the field being read. | ||
65 | 73 | * @param[out] ret_ptr DRIZZLE_RETURN_* | ||
66 | 74 | * | ||
67 | 63 | */ | 75 | */ |
68 | 64 | DRIZZLE_API | 76 | DRIZZLE_API |
71 | 65 | drizzle_field_t drizzle_field_read(drizzle_result_st *result, size_t *offset, | 77 | drizzle_field_t drizzle_field_read(drizzle_result_st *result, uint64_t *offset, |
72 | 66 | size_t *size, size_t *total, | 78 | size_t *size, uint64_t *total, |
73 | 67 | drizzle_return_t *ret_ptr); | 79 | drizzle_return_t *ret_ptr); |
74 | 68 | 80 | ||
75 | 69 | /** | 81 | /** |
76 | 70 | * Buffer one field. | 82 | * Buffer one field. |
77 | 83 | * | ||
78 | 84 | * The return value is a newly allocated buffer and must be freed using drizzle_field_free | ||
79 | 85 | * when no longer needed. | ||
80 | 71 | */ | 86 | */ |
81 | 72 | DRIZZLE_API | 87 | DRIZZLE_API |
82 | 73 | drizzle_field_t drizzle_field_buffer(drizzle_result_st *result, size_t *total, | 88 | drizzle_field_t drizzle_field_buffer(drizzle_result_st *result, size_t *total, |
83 | 74 | 89 | ||
84 | === modified file 'libdrizzle/binlog.cc' | |||
85 | --- libdrizzle/binlog.cc 2013-01-28 01:04:53 +0000 | |||
86 | +++ libdrizzle/binlog.cc 2013-03-12 16:48:27 +0000 | |||
87 | @@ -289,10 +289,10 @@ | |||
88 | 289 | con->packet_size-= 9; | 289 | con->packet_size-= 9; |
89 | 290 | 290 | ||
90 | 291 | snprintf(con->last_error, DRIZZLE_MAX_ERROR_SIZE, "%.*s", | 291 | snprintf(con->last_error, DRIZZLE_MAX_ERROR_SIZE, "%.*s", |
92 | 292 | (int32_t)con->packet_size, con->buffer_ptr); | 292 | (int)con->packet_size, con->buffer_ptr); |
93 | 293 | con->last_error[DRIZZLE_MAX_ERROR_SIZE-1]= 0; | 293 | con->last_error[DRIZZLE_MAX_ERROR_SIZE-1]= 0; |
94 | 294 | snprintf(con->result->info, DRIZZLE_MAX_INFO_SIZE, "%.*s", | 294 | snprintf(con->result->info, DRIZZLE_MAX_INFO_SIZE, "%.*s", |
96 | 295 | (int32_t)con->packet_size, con->buffer_ptr); | 295 | (int)con->packet_size, con->buffer_ptr); |
97 | 296 | con->result->info[DRIZZLE_MAX_INFO_SIZE-1]= 0; | 296 | con->result->info[DRIZZLE_MAX_INFO_SIZE-1]= 0; |
98 | 297 | con->buffer_ptr+= con->packet_size; | 297 | con->buffer_ptr+= con->packet_size; |
99 | 298 | con->buffer_size-= con->packet_size; | 298 | con->buffer_size-= con->packet_size; |
100 | @@ -315,7 +315,7 @@ | |||
101 | 315 | if (con->packet_size != binlog_event->length) | 315 | if (con->packet_size != binlog_event->length) |
102 | 316 | { | 316 | { |
103 | 317 | drizzle_set_error(con, "drizzle_state_binlog_read", | 317 | drizzle_set_error(con, "drizzle_state_binlog_read", |
105 | 318 | "packet size error:%zu:%zu", con->packet_size, binlog_event->length); | 318 | "packet size error:%"PRIu32":%"PRIu32, con->packet_size, binlog_event->length); |
106 | 319 | con->binlog->error_fn(DRIZZLE_RETURN_UNEXPECTED_DATA, con, con->binlog->binlog_context); | 319 | con->binlog->error_fn(DRIZZLE_RETURN_UNEXPECTED_DATA, con, con->binlog->binlog_context); |
107 | 320 | return DRIZZLE_RETURN_UNEXPECTED_DATA; | 320 | return DRIZZLE_RETURN_UNEXPECTED_DATA; |
108 | 321 | } | 321 | } |
109 | @@ -370,10 +370,10 @@ | |||
110 | 370 | memcpy(&binlog_event->checksum, binlog_event->raw_data + (binlog_event->raw_length - DRIZZLE_BINLOG_CRC32_LEN), DRIZZLE_BINLOG_CRC32_LEN); | 370 | memcpy(&binlog_event->checksum, binlog_event->raw_data + (binlog_event->raw_length - DRIZZLE_BINLOG_CRC32_LEN), DRIZZLE_BINLOG_CRC32_LEN); |
111 | 371 | if (con->binlog->verify_checksums) | 371 | if (con->binlog->verify_checksums) |
112 | 372 | { | 372 | { |
114 | 373 | event_crc= crc32(0, binlog_event->raw_data, (binlog_event->raw_length - DRIZZLE_BINLOG_CRC32_LEN)); | 373 | event_crc= (uint32_t)crc32(0, binlog_event->raw_data, (binlog_event->raw_length - DRIZZLE_BINLOG_CRC32_LEN)); |
115 | 374 | if (event_crc != binlog_event->checksum) | 374 | if (event_crc != binlog_event->checksum) |
116 | 375 | { | 375 | { |
118 | 376 | drizzle_set_error(con, __func__, "CRC doesn't match: 0x%lX, 0x%lX", event_crc, binlog_event->checksum); | 376 | drizzle_set_error(con, __func__, "CRC doesn't match: 0x%"PRIX32", 0x%"PRIX32, event_crc, binlog_event->checksum); |
119 | 377 | con->binlog->error_fn(DRIZZLE_RETURN_BINLOG_CRC, con, con->binlog->binlog_context); | 377 | con->binlog->error_fn(DRIZZLE_RETURN_BINLOG_CRC, con, con->binlog->binlog_context); |
120 | 378 | return DRIZZLE_RETURN_BINLOG_CRC; | 378 | return DRIZZLE_RETURN_BINLOG_CRC; |
121 | 379 | } | 379 | } |
122 | 380 | 380 | ||
123 | === modified file 'libdrizzle/conn.cc' | |||
124 | --- libdrizzle/conn.cc 2013-01-27 11:55:48 +0000 | |||
125 | +++ libdrizzle/conn.cc 2013-03-12 16:48:27 +0000 | |||
126 | @@ -724,6 +724,12 @@ | |||
127 | 724 | { | 724 | { |
128 | 725 | drizzle_result_st *result; | 725 | drizzle_result_st *result; |
129 | 726 | drizzle_return_t ret; | 726 | drizzle_return_t ret; |
130 | 727 | |||
131 | 728 | if (db == NULL) | ||
132 | 729 | { | ||
133 | 730 | return DRIZZLE_RETURN_INVALID_ARGUMENT; | ||
134 | 731 | } | ||
135 | 732 | |||
136 | 727 | drizzle_set_db(con, db); | 733 | drizzle_set_db(con, db); |
137 | 728 | result= drizzle_command_write(con, NULL, DRIZZLE_COMMAND_INIT_DB, | 734 | result= drizzle_command_write(con, NULL, DRIZZLE_COMMAND_INIT_DB, |
138 | 729 | db, strlen(db), strlen(db), &ret); | 735 | db, strlen(db), strlen(db), &ret); |
139 | 730 | 736 | ||
140 | === modified file 'libdrizzle/field.cc' | |||
141 | --- libdrizzle/field.cc 2013-01-27 11:55:48 +0000 | |||
142 | +++ libdrizzle/field.cc 2013-03-12 16:48:27 +0000 | |||
143 | @@ -48,8 +48,8 @@ | |||
144 | 48 | * Client definitions | 48 | * Client definitions |
145 | 49 | */ | 49 | */ |
146 | 50 | 50 | ||
149 | 51 | drizzle_field_t drizzle_field_read(drizzle_result_st *result, size_t *offset, | 51 | drizzle_field_t drizzle_field_read(drizzle_result_st *result, uint64_t *offset, |
150 | 52 | size_t *size, size_t *total, | 52 | size_t *size, uint64_t *total, |
151 | 53 | drizzle_return_t *ret_ptr) | 53 | drizzle_return_t *ret_ptr) |
152 | 54 | { | 54 | { |
153 | 55 | drizzle_return_t unused_ret; | 55 | drizzle_return_t unused_ret; |
154 | @@ -115,8 +115,9 @@ | |||
155 | 115 | drizzle_field_t drizzle_field_buffer(drizzle_result_st *result, size_t *total, | 115 | drizzle_field_t drizzle_field_buffer(drizzle_result_st *result, size_t *total, |
156 | 116 | drizzle_return_t *ret_ptr) | 116 | drizzle_return_t *ret_ptr) |
157 | 117 | { | 117 | { |
159 | 118 | size_t offset= 0; | 118 | uint64_t offset= 0; |
160 | 119 | size_t size= 0; | 119 | size_t size= 0; |
161 | 120 | uint64_t wire_size; | ||
162 | 120 | 121 | ||
163 | 121 | drizzle_return_t unused_ret; | 122 | drizzle_return_t unused_ret; |
164 | 122 | if (ret_ptr == NULL) | 123 | if (ret_ptr == NULL) |
165 | @@ -130,7 +131,7 @@ | |||
166 | 130 | return 0; | 131 | return 0; |
167 | 131 | } | 132 | } |
168 | 132 | 133 | ||
170 | 133 | drizzle_field_t field= drizzle_field_read(result, &offset, &size, total, ret_ptr); | 134 | drizzle_field_t field= drizzle_field_read(result, &offset, &size, &wire_size, ret_ptr); |
171 | 134 | 135 | ||
172 | 135 | if (*ret_ptr != DRIZZLE_RETURN_OK) | 136 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
173 | 136 | { | 137 | { |
174 | @@ -143,6 +144,14 @@ | |||
175 | 143 | return NULL; | 144 | return NULL; |
176 | 144 | } | 145 | } |
177 | 145 | 146 | ||
178 | 147 | if ((SIZE_MAX < UINT64_MAX) && (wire_size >= SIZE_MAX)) | ||
179 | 148 | { | ||
180 | 149 | drizzle_set_error(result->con, __func__, "Field is larger than memory."); | ||
181 | 150 | *ret_ptr= DRIZZLE_RETURN_MEMORY; | ||
182 | 151 | return NULL; | ||
183 | 152 | } | ||
184 | 153 | *total = (size_t)wire_size; | ||
185 | 154 | |||
186 | 146 | if (result->field_buffer == NULL) | 155 | if (result->field_buffer == NULL) |
187 | 147 | { | 156 | { |
188 | 148 | result->field_buffer= new (std::nothrow) char[(*total) + 1]; | 157 | result->field_buffer= new (std::nothrow) char[(*total) + 1]; |
189 | @@ -158,12 +167,13 @@ | |||
190 | 158 | 167 | ||
191 | 159 | while ((offset + size) != (*total)) | 168 | while ((offset + size) != (*total)) |
192 | 160 | { | 169 | { |
194 | 161 | field= drizzle_field_read(result, &offset, &size, total, ret_ptr); | 170 | field= drizzle_field_read(result, &offset, &size, &wire_size, ret_ptr); |
195 | 162 | if (*ret_ptr != DRIZZLE_RETURN_OK) | 171 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
196 | 163 | { | 172 | { |
197 | 164 | return NULL; | 173 | return NULL; |
198 | 165 | } | 174 | } |
200 | 166 | 175 | assert(wire_size == (uint64_t)*total); | |
201 | 176 | |||
202 | 167 | memcpy(result->field_buffer + offset, field, size); | 177 | memcpy(result->field_buffer + offset, field, size); |
203 | 168 | } | 178 | } |
204 | 169 | 179 | ||
205 | @@ -207,7 +217,7 @@ | |||
206 | 207 | con->result->field_size= 0; | 217 | con->result->field_size= 0; |
207 | 208 | 218 | ||
208 | 209 | drizzle_return_t ret; | 219 | drizzle_return_t ret; |
210 | 210 | con->result->field_total= (size_t)drizzle_unpack_length(con, &ret); | 220 | con->result->field_total= drizzle_unpack_length(con, &ret); |
211 | 211 | if (ret == DRIZZLE_RETURN_NULL_SIZE) | 221 | if (ret == DRIZZLE_RETURN_NULL_SIZE) |
212 | 212 | { | 222 | { |
213 | 213 | con->result->field= NULL; | 223 | con->result->field= NULL; |
214 | @@ -227,35 +237,43 @@ | |||
215 | 227 | } | 237 | } |
216 | 228 | 238 | ||
217 | 229 | drizzle_log_debug(con, | 239 | drizzle_log_debug(con, |
219 | 230 | "field_offset= %zu, field_size= %zu, field_total= %zu", | 240 | "field_offset= %"PRIu64", field_size= %zu, field_total= %"PRIu64, |
220 | 231 | con->result->field_offset, con->result->field_size, | 241 | con->result->field_offset, con->result->field_size, |
221 | 232 | con->result->field_total); | 242 | con->result->field_total); |
222 | 233 | 243 | ||
224 | 234 | if ((size_t)(con->buffer_size) >= con->result->field_total) | 244 | uint32_t available_data = (con->buffer_size < con->packet_size)? (uint32_t)con->buffer_size : con->packet_size; |
225 | 245 | /* packet_size fits in uint32, so available_data fits in uint32 */ | ||
226 | 246 | |||
227 | 247 | if (available_data >= con->result->field_total) | ||
228 | 235 | { | 248 | { |
230 | 236 | con->result->field_size= con->result->field_total; | 249 | /* narrowing cast is safe because field_total<packet_size and packet_size is uint32 */ |
231 | 250 | con->result->field_size= (uint32_t)con->result->field_total; | ||
232 | 237 | } | 251 | } |
233 | 238 | else | 252 | else |
234 | 239 | { | 253 | { |
236 | 240 | con->result->field_size= con->buffer_size; | 254 | con->result->field_size= available_data; |
237 | 241 | } | 255 | } |
238 | 242 | } | 256 | } |
239 | 243 | else | 257 | else |
240 | 244 | { | 258 | { |
243 | 245 | if ((con->result->field_offset + con->buffer_size) >= | 259 | uint32_t available_data = (con->buffer_size < con->packet_size)? (uint32_t)con->buffer_size : con->packet_size; |
244 | 246 | con->result->field_total) | 260 | /* packet_size fits in uint32, so available_data fits in uint32 */ |
245 | 261 | |||
246 | 262 | uint64_t field_remaining = con->result->field_total - con->result->field_offset; | ||
247 | 263 | |||
248 | 264 | if (field_remaining <= available_data) | ||
249 | 247 | { | 265 | { |
252 | 248 | con->result->field_size= (con->result->field_total - | 266 | /* narrowing cast is safe because field_remaining<=packet_size and packet_size is uint32 */ |
253 | 249 | con->result->field_offset); | 267 | con->result->field_size= (uint32_t)field_remaining; |
254 | 250 | } | 268 | } |
255 | 251 | else | 269 | else |
256 | 252 | { | 270 | { |
258 | 253 | con->result->field_size= con->buffer_size; | 271 | con->result->field_size= available_data; |
259 | 254 | } | 272 | } |
260 | 255 | } | 273 | } |
261 | 256 | 274 | ||
262 | 257 | /* This is a special case when a row is larger than the packet size. */ | 275 | /* This is a special case when a row is larger than the packet size. */ |
264 | 258 | if (con->result->field_size > (size_t)con->packet_size) | 276 | if (con->result->field_size > con->packet_size) |
265 | 259 | { | 277 | { |
266 | 260 | con->result->field_size= con->packet_size; | 278 | con->result->field_size= con->packet_size; |
267 | 261 | 279 | ||
268 | @@ -277,7 +295,7 @@ | |||
269 | 277 | con->packet_size-= con->result->field_size; | 295 | con->packet_size-= con->result->field_size; |
270 | 278 | 296 | ||
271 | 279 | drizzle_log_debug(con, | 297 | drizzle_log_debug(con, |
273 | 280 | "field_offset= %zu, field_size= %zu, field_total= %zu", | 298 | "field_offset= %"PRIu64", field_size= %zu, field_total= %"PRIu64, |
274 | 281 | con->result->field_offset, con->result->field_size, | 299 | con->result->field_offset, con->result->field_size, |
275 | 282 | con->result->field_total); | 300 | con->result->field_total); |
276 | 283 | 301 | ||
277 | 284 | 302 | ||
278 | === modified file 'libdrizzle/handshake.cc' | |||
279 | --- libdrizzle/handshake.cc 2013-01-27 11:55:48 +0000 | |||
280 | +++ libdrizzle/handshake.cc 2013-03-12 16:48:27 +0000 | |||
281 | @@ -83,7 +83,7 @@ | |||
282 | 83 | drizzle_return_t drizzle_state_handshake_server_read(drizzle_st *con) | 83 | drizzle_return_t drizzle_state_handshake_server_read(drizzle_st *con) |
283 | 84 | { | 84 | { |
284 | 85 | unsigned char *ptr; | 85 | unsigned char *ptr; |
286 | 86 | int extra_length; | 86 | ptrdiff_t extra_length; |
287 | 87 | unsigned char* packet_end; | 87 | unsigned char* packet_end; |
288 | 88 | 88 | ||
289 | 89 | if (con == NULL) | 89 | if (con == NULL) |
290 | @@ -117,7 +117,7 @@ | |||
291 | 117 | if (con->protocol_version == 255) | 117 | if (con->protocol_version == 255) |
292 | 118 | { | 118 | { |
293 | 119 | drizzle_set_error(con, "drizzle_state_handshake_server_read", | 119 | drizzle_set_error(con, "drizzle_state_handshake_server_read", |
295 | 120 | "%.*s", (int32_t)con->packet_size - 3, | 120 | "%.*s", (int)con->packet_size - 3, |
296 | 121 | con->buffer_ptr + 2); | 121 | con->buffer_ptr + 2); |
297 | 122 | return DRIZZLE_RETURN_AUTH_FAILED; | 122 | return DRIZZLE_RETURN_AUTH_FAILED; |
298 | 123 | } | 123 | } |
299 | 124 | 124 | ||
300 | === modified file 'libdrizzle/pack.cc' | |||
301 | --- libdrizzle/pack.cc 2013-01-27 11:55:48 +0000 | |||
302 | +++ libdrizzle/pack.cc 2013-03-12 16:48:27 +0000 | |||
303 | @@ -165,12 +165,12 @@ | |||
304 | 165 | return NULL; | 165 | return NULL; |
305 | 166 | } | 166 | } |
306 | 167 | 167 | ||
308 | 168 | uint64_t size= strlen(string); | 168 | size_t size= strlen(string); |
309 | 169 | 169 | ||
310 | 170 | ptr= drizzle_pack_length(size, ptr); | 170 | ptr= drizzle_pack_length(size, ptr); |
311 | 171 | if (size > 0) | 171 | if (size > 0) |
312 | 172 | { | 172 | { |
314 | 173 | memcpy(ptr, string, (size_t)size); | 173 | memcpy(ptr, string, size); |
315 | 174 | ptr+= size; | 174 | ptr+= size; |
316 | 175 | } | 175 | } |
317 | 176 | 176 | ||
318 | @@ -292,7 +292,7 @@ | |||
319 | 292 | } | 292 | } |
320 | 293 | 293 | ||
321 | 294 | drizzle_return_t drizzle_unpack_string(drizzle_st *con, char *buffer, | 294 | drizzle_return_t drizzle_unpack_string(drizzle_st *con, char *buffer, |
323 | 295 | uint64_t max_length) | 295 | size_t max_length) |
324 | 296 | { | 296 | { |
325 | 297 | drizzle_return_t ret= DRIZZLE_RETURN_OK; | 297 | drizzle_return_t ret= DRIZZLE_RETURN_OK; |
326 | 298 | 298 | ||
327 | @@ -313,6 +313,18 @@ | |||
328 | 313 | return ret; | 313 | return ret; |
329 | 314 | } | 314 | } |
330 | 315 | 315 | ||
331 | 316 | if (length > con->packet_size) | ||
332 | 317 | { | ||
333 | 318 | drizzle_set_error(con, "drizzle_unpack_string", | ||
334 | 319 | "string extends past end of packet"); | ||
335 | 320 | return DRIZZLE_RETURN_UNEXPECTED_DATA; | ||
336 | 321 | } | ||
337 | 322 | if (length > con->buffer_size) | ||
338 | 323 | { | ||
339 | 324 | return DRIZZLE_RETURN_IO_WAIT; | ||
340 | 325 | } | ||
341 | 326 | |||
342 | 327 | assert(max_length > 1); | ||
343 | 316 | if (length < max_length) | 328 | if (length < max_length) |
344 | 317 | { | 329 | { |
345 | 318 | if (length > 0) | 330 | if (length > 0) |
346 | @@ -322,13 +334,13 @@ | |||
347 | 322 | } | 334 | } |
348 | 323 | else | 335 | else |
349 | 324 | { | 336 | { |
351 | 325 | memcpy(buffer, con->buffer_ptr, (size_t)(max_length - 1)); | 337 | memcpy(buffer, con->buffer_ptr, max_length - 1); |
352 | 326 | buffer[max_length - 1]= 0; | 338 | buffer[max_length - 1]= 0; |
353 | 327 | } | 339 | } |
355 | 328 | 340 | ||
356 | 329 | con->buffer_ptr+= length; | 341 | con->buffer_ptr+= length; |
359 | 330 | con->buffer_size-= (size_t)length; | 342 | con->buffer_size-= length; |
360 | 331 | con->packet_size-= (size_t)length; | 343 | con->packet_size-= (uint32_t)length; |
361 | 332 | 344 | ||
362 | 333 | return DRIZZLE_RETURN_OK; | 345 | return DRIZZLE_RETURN_OK; |
363 | 334 | } | 346 | } |
364 | 335 | 347 | ||
365 | === modified file 'libdrizzle/pack.h' | |||
366 | --- libdrizzle/pack.h 2013-01-27 11:55:48 +0000 | |||
367 | +++ libdrizzle/pack.h 2013-03-12 16:48:27 +0000 | |||
368 | @@ -85,9 +85,10 @@ | |||
369 | 85 | 85 | ||
370 | 86 | /** | 86 | /** |
371 | 87 | * Unpack length-encoded string. | 87 | * Unpack length-encoded string. |
372 | 88 | * max_size is a size_t because it describes the size of the in-core 'buffer'. | ||
373 | 88 | */ | 89 | */ |
374 | 89 | drizzle_return_t drizzle_unpack_string(drizzle_st *con, char *buffer, | 90 | drizzle_return_t drizzle_unpack_string(drizzle_st *con, char *buffer, |
376 | 90 | uint64_t max_size); | 91 | size_t max_size); |
377 | 91 | 92 | ||
378 | 92 | /** | 93 | /** |
379 | 93 | * Pack user, scramble, and db. | 94 | * Pack user, scramble, and db. |
380 | 94 | 95 | ||
381 | === modified file 'libdrizzle/result.cc' | |||
382 | --- libdrizzle/result.cc 2013-01-27 14:00:17 +0000 | |||
383 | +++ libdrizzle/result.cc 2013-03-12 16:48:27 +0000 | |||
384 | @@ -314,16 +314,20 @@ | |||
385 | 314 | 314 | ||
386 | 315 | if (result->row_list_size < result->row_count) | 315 | if (result->row_list_size < result->row_count) |
387 | 316 | { | 316 | { |
389 | 317 | row_list= (drizzle_row_t *)realloc(result->row_list, sizeof(drizzle_row_t) * ((size_t)(result->row_list_size) + DRIZZLE_ROW_GROW_SIZE)); | 317 | size_t new_row_list_size = result->row_list_size + DRIZZLE_ROW_GROW_SIZE; |
390 | 318 | |||
391 | 319 | row_list= (drizzle_row_t *)realloc(result->row_list, sizeof(drizzle_row_t) * new_row_list_size); | ||
392 | 318 | if (row_list == NULL) | 320 | if (row_list == NULL) |
393 | 319 | { | 321 | { |
394 | 320 | drizzle_row_free(result, row); | 322 | drizzle_row_free(result, row); |
395 | 321 | drizzle_set_error(result->con, __func__, "Failed to realloc row_list."); | 323 | drizzle_set_error(result->con, __func__, "Failed to realloc row_list."); |
396 | 322 | return DRIZZLE_RETURN_MEMORY; | 324 | return DRIZZLE_RETURN_MEMORY; |
397 | 323 | } | 325 | } |
398 | 326 | result->row_list= row_list; | ||
399 | 327 | |||
400 | 324 | if (result->binary_rows) | 328 | if (result->binary_rows) |
401 | 325 | { | 329 | { |
403 | 326 | uint8_t **null_bitmap_list= (uint8_t**)realloc(result->null_bitmap_list, sizeof(uint8_t*) * ((size_t)(result->row_list_size) + DRIZZLE_ROW_GROW_SIZE)); | 330 | uint8_t **null_bitmap_list= (uint8_t **)realloc(result->null_bitmap_list, sizeof(uint8_t *) * new_row_list_size); |
404 | 327 | if (null_bitmap_list == NULL) | 331 | if (null_bitmap_list == NULL) |
405 | 328 | { | 332 | { |
406 | 329 | drizzle_row_free(result, row); | 333 | drizzle_row_free(result, row); |
407 | @@ -332,19 +336,17 @@ | |||
408 | 332 | } | 336 | } |
409 | 333 | result->null_bitmap_list= null_bitmap_list; | 337 | result->null_bitmap_list= null_bitmap_list; |
410 | 334 | } | 338 | } |
411 | 335 | result->row_list= row_list; | ||
412 | 336 | 339 | ||
414 | 337 | field_sizes_list= (size_t **)realloc(result->field_sizes_list, sizeof(size_t *) * ((size_t)(result->row_list_size) + DRIZZLE_ROW_GROW_SIZE)); | 340 | field_sizes_list= (size_t **)realloc(result->field_sizes_list, sizeof(size_t *) * new_row_list_size); |
415 | 338 | if (field_sizes_list == NULL) | 341 | if (field_sizes_list == NULL) |
416 | 339 | { | 342 | { |
417 | 340 | drizzle_row_free(result, row); | 343 | drizzle_row_free(result, row); |
418 | 341 | drizzle_set_error(result->con, "drizzle_result_buffer", "Failed to realloc field list."); | 344 | drizzle_set_error(result->con, "drizzle_result_buffer", "Failed to realloc field list."); |
419 | 342 | return DRIZZLE_RETURN_MEMORY; | 345 | return DRIZZLE_RETURN_MEMORY; |
420 | 343 | } | 346 | } |
421 | 344 | |||
422 | 345 | result->field_sizes_list= field_sizes_list; | 347 | result->field_sizes_list= field_sizes_list; |
423 | 346 | 348 | ||
425 | 347 | result->row_list_size+= DRIZZLE_ROW_GROW_SIZE; | 349 | result->row_list_size= new_row_list_size; |
426 | 348 | } | 350 | } |
427 | 349 | 351 | ||
428 | 350 | if (result->binary_rows) | 352 | if (result->binary_rows) |
429 | @@ -460,10 +462,10 @@ | |||
430 | 460 | if (con->packet_size > 0) | 462 | if (con->packet_size > 0) |
431 | 461 | { | 463 | { |
432 | 462 | snprintf(con->last_error, DRIZZLE_MAX_ERROR_SIZE, "%.*s", | 464 | snprintf(con->last_error, DRIZZLE_MAX_ERROR_SIZE, "%.*s", |
434 | 463 | (int32_t)con->packet_size, con->buffer_ptr); | 465 | (int)con->packet_size, con->buffer_ptr); |
435 | 464 | con->last_error[DRIZZLE_MAX_ERROR_SIZE-1]= 0; | 466 | con->last_error[DRIZZLE_MAX_ERROR_SIZE-1]= 0; |
436 | 465 | snprintf(con->result->info, DRIZZLE_MAX_INFO_SIZE, "%.*s", | 467 | snprintf(con->result->info, DRIZZLE_MAX_INFO_SIZE, "%.*s", |
438 | 466 | (int32_t)con->packet_size, con->buffer_ptr); | 468 | (int)con->packet_size, con->buffer_ptr); |
439 | 467 | con->result->info[DRIZZLE_MAX_INFO_SIZE-1]= 0; | 469 | con->result->info[DRIZZLE_MAX_INFO_SIZE-1]= 0; |
440 | 468 | con->buffer_ptr+= con->packet_size; | 470 | con->buffer_ptr+= con->packet_size; |
441 | 469 | con->buffer_size-= con->packet_size; | 471 | con->buffer_size-= con->packet_size; |
442 | 470 | 472 | ||
443 | === modified file 'libdrizzle/result.h' | |||
444 | --- libdrizzle/result.h 2013-01-27 11:22:49 +0000 | |||
445 | +++ libdrizzle/result.h 2013-03-12 16:48:27 +0000 | |||
446 | @@ -64,14 +64,14 @@ | |||
447 | 64 | uint64_t row_count; | 64 | uint64_t row_count; |
448 | 65 | uint64_t row_current; | 65 | uint64_t row_current; |
449 | 66 | 66 | ||
454 | 67 | uint16_t field_current; | 67 | uint16_t field_current; /* field index */ |
455 | 68 | size_t field_total; | 68 | uint64_t field_total; /* total length of the field currently being read */ |
456 | 69 | size_t field_offset; | 69 | uint64_t field_offset; /* offset within field of most recently read field fragment (0 if first/only fragment) */ |
457 | 70 | size_t field_size; | 70 | uint32_t field_size; /* size of most recently read field value or fragment of field value; max 2^24 */ |
458 | 71 | drizzle_field_t field; | 71 | drizzle_field_t field; |
459 | 72 | drizzle_field_t field_buffer; | 72 | drizzle_field_t field_buffer; |
460 | 73 | 73 | ||
462 | 74 | uint64_t row_list_size; | 74 | size_t row_list_size; |
463 | 75 | drizzle_row_t row; | 75 | drizzle_row_t row; |
464 | 76 | drizzle_row_t *row_list; | 76 | drizzle_row_t *row_list; |
465 | 77 | size_t *field_sizes; | 77 | size_t *field_sizes; |
466 | @@ -80,7 +80,7 @@ | |||
467 | 80 | bool binlog_checksums; | 80 | bool binlog_checksums; |
468 | 81 | uint8_t **null_bitmap_list; | 81 | uint8_t **null_bitmap_list; |
469 | 82 | uint8_t *null_bitmap; | 82 | uint8_t *null_bitmap; |
471 | 83 | uint8_t null_bitmap_length; | 83 | uint16_t null_bitmap_length; |
472 | 84 | bool binary_rows; | 84 | bool binary_rows; |
473 | 85 | 85 | ||
474 | 86 | drizzle_result_st() : | 86 | drizzle_result_st() : |
475 | 87 | 87 | ||
476 | === modified file 'libdrizzle/statement.cc' | |||
477 | --- libdrizzle/statement.cc 2013-01-27 09:48:19 +0000 | |||
478 | +++ libdrizzle/statement.cc 2013-03-12 16:48:27 +0000 | |||
479 | @@ -320,7 +320,7 @@ | |||
480 | 320 | 320 | ||
481 | 321 | if (stmt->state < DRIZZLE_STMT_PREPARED) | 321 | if (stmt->state < DRIZZLE_STMT_PREPARED) |
482 | 322 | { | 322 | { |
484 | 323 | drizzle_set_error(stmt->con, __func__, "stmt object has bot been prepared"); | 323 | drizzle_set_error(stmt->con, __func__, "stmt object has not been prepared"); |
485 | 324 | return DRIZZLE_RETURN_STMT_ERROR; | 324 | return DRIZZLE_RETURN_STMT_ERROR; |
486 | 325 | } | 325 | } |
487 | 326 | 326 | ||
488 | 327 | 327 | ||
489 | === modified file 'libdrizzle/statement_param.cc' | |||
490 | --- libdrizzle/statement_param.cc 2013-01-27 11:55:48 +0000 | |||
491 | +++ libdrizzle/statement_param.cc 2013-03-12 16:48:27 +0000 | |||
492 | @@ -47,7 +47,7 @@ | |||
493 | 47 | } | 47 | } |
494 | 48 | if (stmt->state < DRIZZLE_STMT_PREPARED) | 48 | if (stmt->state < DRIZZLE_STMT_PREPARED) |
495 | 49 | { | 49 | { |
497 | 50 | drizzle_set_error(stmt->con, __func__, "stmt object has bot been prepared"); | 50 | drizzle_set_error(stmt->con, __func__, "stmt object has not been prepared"); |
498 | 51 | return DRIZZLE_RETURN_STMT_ERROR; | 51 | return DRIZZLE_RETURN_STMT_ERROR; |
499 | 52 | } | 52 | } |
500 | 53 | 53 | ||
501 | @@ -165,6 +165,7 @@ | |||
502 | 165 | if ((stmt == NULL) || (stmt->result_params == NULL)) | 165 | if ((stmt == NULL) || (stmt->result_params == NULL)) |
503 | 166 | { | 166 | { |
504 | 167 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; | 167 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
505 | 168 | return 0; | ||
506 | 168 | } | 169 | } |
507 | 169 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); | 170 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
508 | 170 | if (*ret_ptr != DRIZZLE_RETURN_OK) | 171 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
509 | @@ -192,6 +193,7 @@ | |||
510 | 192 | if ((stmt == NULL) || (stmt->result_params == NULL)) | 193 | if ((stmt == NULL) || (stmt->result_params == NULL)) |
511 | 193 | { | 194 | { |
512 | 194 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; | 195 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
513 | 196 | return 0; | ||
514 | 195 | } | 197 | } |
515 | 196 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); | 198 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
516 | 197 | if (*ret_ptr != DRIZZLE_RETURN_OK) | 199 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
517 | @@ -219,6 +221,7 @@ | |||
518 | 219 | if ((stmt == NULL) || (stmt->result_params == NULL)) | 221 | if ((stmt == NULL) || (stmt->result_params == NULL)) |
519 | 220 | { | 222 | { |
520 | 221 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; | 223 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
521 | 224 | return 0; | ||
522 | 222 | } | 225 | } |
523 | 223 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); | 226 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
524 | 224 | if (*ret_ptr != DRIZZLE_RETURN_OK) | 227 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
525 | @@ -318,6 +321,7 @@ | |||
526 | 318 | if ((stmt == NULL) || (stmt->result_params == NULL)) | 321 | if ((stmt == NULL) || (stmt->result_params == NULL)) |
527 | 319 | { | 322 | { |
528 | 320 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; | 323 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
529 | 324 | return 0; | ||
530 | 321 | } | 325 | } |
531 | 322 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); | 326 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
532 | 323 | if (*ret_ptr != DRIZZLE_RETURN_OK) | 327 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
533 | @@ -407,6 +411,7 @@ | |||
534 | 407 | if ((stmt == NULL) || (stmt->result_params == NULL)) | 411 | if ((stmt == NULL) || (stmt->result_params == NULL)) |
535 | 408 | { | 412 | { |
536 | 409 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; | 413 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
537 | 414 | return 0; | ||
538 | 410 | } | 415 | } |
539 | 411 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); | 416 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
540 | 412 | if (*ret_ptr != DRIZZLE_RETURN_OK) | 417 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
541 | @@ -418,7 +423,7 @@ | |||
542 | 418 | 423 | ||
543 | 419 | uint64_t drizzle_stmt_get_bigint(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) | 424 | uint64_t drizzle_stmt_get_bigint(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
544 | 420 | { | 425 | { |
546 | 421 | uint32_t val; | 426 | uint64_t val; |
547 | 422 | drizzle_bind_st *param; | 427 | drizzle_bind_st *param; |
548 | 423 | 428 | ||
549 | 424 | if ((stmt == NULL) || (stmt->result_params == NULL) || (column_number >= stmt->execute_result->column_count)) | 429 | if ((stmt == NULL) || (stmt->result_params == NULL) || (column_number >= stmt->execute_result->column_count)) |
550 | @@ -492,6 +497,7 @@ | |||
551 | 492 | if ((stmt == NULL) || (stmt->result_params == NULL)) | 497 | if ((stmt == NULL) || (stmt->result_params == NULL)) |
552 | 493 | { | 498 | { |
553 | 494 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; | 499 | *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
554 | 500 | return 0; | ||
555 | 495 | } | 501 | } |
556 | 496 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); | 502 | column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
557 | 497 | if (*ret_ptr != DRIZZLE_RETURN_OK) | 503 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
558 | 498 | 504 | ||
559 | === modified file 'libdrizzle/structs.h' | |||
560 | --- libdrizzle/structs.h 2013-01-27 14:00:17 +0000 | |||
561 | +++ libdrizzle/structs.h 2013-03-12 16:48:27 +0000 | |||
562 | @@ -208,13 +208,13 @@ | |||
563 | 208 | uint32_t thread_id; | 208 | uint32_t thread_id; |
564 | 209 | int backlog; | 209 | int backlog; |
565 | 210 | socket_t fd; | 210 | socket_t fd; |
567 | 211 | size_t buffer_size; | 211 | size_t buffer_size; /* amount of valid data after 'buffer_ptr' in 'buffer' */ |
568 | 212 | size_t command_offset; | 212 | size_t command_offset; |
569 | 213 | size_t command_size; | 213 | size_t command_size; |
570 | 214 | size_t command_total; | 214 | size_t command_total; |
572 | 215 | size_t packet_size; | 215 | uint32_t packet_size; /* remaining number of bytes in packet currently being read; maximum value 2^24 */ |
573 | 216 | struct addrinfo *addrinfo_next; | 216 | struct addrinfo *addrinfo_next; |
575 | 217 | unsigned char *buffer_ptr; | 217 | unsigned char *buffer_ptr; /* cursor pointing into 'buffer' */ |
576 | 218 | unsigned char *command_buffer; | 218 | unsigned char *command_buffer; |
577 | 219 | unsigned char *command_data; | 219 | unsigned char *command_data; |
578 | 220 | void *context; | 220 | void *context; |
579 | @@ -228,7 +228,7 @@ | |||
580 | 228 | drizzle_uds_st uds; | 228 | drizzle_uds_st uds; |
581 | 229 | } socket; | 229 | } socket; |
582 | 230 | unsigned char *buffer; | 230 | unsigned char *buffer; |
584 | 231 | size_t buffer_allocation; | 231 | size_t buffer_allocation; /* total allocated size of 'buffer' */ |
585 | 232 | char db[DRIZZLE_MAX_DB_SIZE]; | 232 | char db[DRIZZLE_MAX_DB_SIZE]; |
586 | 233 | char password[DRIZZLE_MAX_PASSWORD_SIZE]; | 233 | char password[DRIZZLE_MAX_PASSWORD_SIZE]; |
587 | 234 | unsigned char scramble_buffer[DRIZZLE_MAX_SCRAMBLE_SIZE]; | 234 | unsigned char scramble_buffer[DRIZZLE_MAX_SCRAMBLE_SIZE]; |
588 | @@ -492,7 +492,7 @@ | |||
589 | 492 | uint16_t param_count; | 492 | uint16_t param_count; |
590 | 493 | drizzle_bind_st *query_params; | 493 | drizzle_bind_st *query_params; |
591 | 494 | drizzle_bind_st *result_params; | 494 | drizzle_bind_st *result_params; |
593 | 495 | uint8_t null_bitmap_length; | 495 | uint16_t null_bitmap_length; |
594 | 496 | uint8_t *null_bitmap; | 496 | uint8_t *null_bitmap; |
595 | 497 | bool new_bind; | 497 | bool new_bind; |
596 | 498 | drizzle_result_st *prepare_result; | 498 | drizzle_result_st *prepare_result; |
597 | @@ -520,7 +520,7 @@ | |||
598 | 520 | drizzle_column_type_t type; | 520 | drizzle_column_type_t type; |
599 | 521 | void *data; | 521 | void *data; |
600 | 522 | char *data_buffer; | 522 | char *data_buffer; |
602 | 523 | uint32_t length; | 523 | size_t length; /* amount of data in 'data' */ |
603 | 524 | bool is_bound; | 524 | bool is_bound; |
604 | 525 | struct options_t | 525 | struct options_t |
605 | 526 | { | 526 | { |
606 | 527 | 527 | ||
607 | === modified file 'tests/unit/statement.c' | |||
608 | --- tests/unit/statement.c 2013-01-27 09:48:19 +0000 | |||
609 | +++ tests/unit/statement.c 2013-03-12 16:48:27 +0000 | |||
610 | @@ -103,7 +103,7 @@ | |||
611 | 103 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "%s", drizzle_error(con)); | 103 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "%s", drizzle_error(con)); |
612 | 104 | 104 | ||
613 | 105 | /* Result should have 2 rows */ | 105 | /* Result should have 2 rows */ |
615 | 106 | int count= drizzle_stmt_row_count(stmt); | 106 | uint64_t count = drizzle_stmt_row_count(stmt); |
616 | 107 | ASSERT_EQ_(2, count, "%s", drizzle_error(con)); | 107 | ASSERT_EQ_(2, count, "%s", drizzle_error(con)); |
617 | 108 | 108 | ||
618 | 109 | uint32_t i= 1; | 109 | uint32_t i= 1; |
Very nice catches in there, most of them my silly mistakes, especially around prepared stmt :)
Worst case this slightly breaks API on the drizzle_field functions, but only for 32bit so I'm not so concerned.