Commit 5eb6d46
Arun Kuruvila
Bug #17883203 : MYSQL EMBEDDED MYSQL_STMT_EXECUTE RETURN
"MALFORMED COMMUNICATION PACKET" ERROR
Description :- C API, "mysql_stmt_execute" fails with an
error, "malformed communication packet", even for a simple
query when prepared statments are used with libmysqld.
Analysis :- The packet size specified in
"emb_stmt_execute()" [libmysqld/lib_sql.cc] and "execute()
[libmysql/libmysql.c] should be consistent across libraries
(libmysqld/libmysql) because "mysql_stmt_execute()"
[sql/sql_prepare.cc ] is being called from both functions
depending upon the libaries (libmysqld/libmysql) used.
Currently the packet size used in "emb_stmt_execute() is 5
and in "execute()" is 9. When the C API,
"mysql_stmt_execute", is executed from an application which
is linked with libmysqld, it fails in the function
"mysql_stmt_execute()" because of incorrect packet size.
Another bug also exists in the "Protocol::net_store_data()"
[libmysqld/lib_sql.cc] due to dereferencing an undefined
"next_field" pointer which results in a segmentation fault.
Fix:-
(a)The packet size is made consistent across libmysqld
and libmysql.
(b) For the problem found internally:
Functions "prepare_for_resend(), "net_store_data()" (with
and without charset conversion) are defined seperately for
Protocol_binary class in case of embedded library.1 parent 51a6239 commit 5eb6d46
4 files changed
Lines changed: 152 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| 330 | + | |
330 | 331 | | |
331 | 332 | | |
332 | 333 | | |
333 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
334 | 340 | | |
335 | 341 | | |
336 | 342 | | |
337 | 343 | | |
338 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
339 | 350 | | |
340 | 351 | | |
341 | 352 | | |
| |||
1276 | 1287 | | |
1277 | 1288 | | |
1278 | 1289 | | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
1279 | 1298 | | |
1280 | 1299 | | |
1281 | 1300 | | |
| |||
1312 | 1331 | | |
1313 | 1332 | | |
1314 | 1333 | | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
1315 | 1406 | | |
1316 | 1407 | | |
1317 | 1408 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 45 | | |
49 | 46 | | |
50 | 47 | | |
| |||
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
62 | | - | |
| 59 | + | |
63 | 60 | | |
64 | 61 | | |
65 | 62 | | |
| |||
1244 | 1241 | | |
1245 | 1242 | | |
1246 | 1243 | | |
| 1244 | + | |
1247 | 1245 | | |
1248 | 1246 | | |
1249 | 1247 | | |
1250 | 1248 | | |
1251 | 1249 | | |
1252 | 1250 | | |
| 1251 | + | |
1253 | 1252 | | |
1254 | 1253 | | |
1255 | 1254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19441 | 19441 | | |
19442 | 19442 | | |
19443 | 19443 | | |
| 19444 | + | |
| 19445 | + | |
| 19446 | + | |
| 19447 | + | |
| 19448 | + | |
| 19449 | + | |
| 19450 | + | |
| 19451 | + | |
| 19452 | + | |
| 19453 | + | |
| 19454 | + | |
| 19455 | + | |
| 19456 | + | |
| 19457 | + | |
| 19458 | + | |
| 19459 | + | |
| 19460 | + | |
| 19461 | + | |
| 19462 | + | |
| 19463 | + | |
| 19464 | + | |
| 19465 | + | |
| 19466 | + | |
| 19467 | + | |
| 19468 | + | |
| 19469 | + | |
| 19470 | + | |
| 19471 | + | |
| 19472 | + | |
| 19473 | + | |
| 19474 | + | |
| 19475 | + | |
| 19476 | + | |
| 19477 | + | |
| 19478 | + | |
| 19479 | + | |
| 19480 | + | |
| 19481 | + | |
| 19482 | + | |
| 19483 | + | |
| 19484 | + | |
| 19485 | + | |
| 19486 | + | |
| 19487 | + | |
| 19488 | + | |
| 19489 | + | |
| 19490 | + | |
19444 | 19491 | | |
19445 | 19492 | | |
19446 | 19493 | | |
| |||
19717 | 19764 | | |
19718 | 19765 | | |
19719 | 19766 | | |
| 19767 | + | |
19720 | 19768 | | |
19721 | 19769 | | |
19722 | 19770 | | |
| |||
0 commit comments