forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita9f0dbc
committed
Fix PQsetvalue() to avoid possible crash when adding a new tuple.
PQsetvalue unnecessarily duplicated the logic in pqAddTuple, and didn'tduplicate it exactly either --- pqAddTuple does not care what is in thetuple-pointer array positions beyond the last valid entry, whereas thecode in PQsetvalue assumed such positions would contain NULL. This ledto possible crashes if PQsetvalue was applied to a PGresult that hadpreviously been enlarged with pqAddTuple, for instance one built from aserver query. Fix by relying on pqAddTuple instead of duplicating logic,and not assuming anything about the contents of res->tuples[res->ntups].Back-patch to 8.4, where PQsetvalue was introduced.Andrew Chernow1 parent0ce7676 commita9f0dbc
1 file changed
+4
-23
lines changedLines changed: 4 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
424 | 424 |
| |
425 | 425 |
| |
426 | 426 |
| |
427 |
| - | |
428 |
| - | |
429 |
| - | |
430 |
| - | |
431 |
| - | |
432 |
| - | |
433 |
| - | |
434 |
| - | |
435 |
| - | |
436 |
| - | |
437 |
| - | |
438 |
| - | |
439 |
| - | |
440 |
| - | |
441 |
| - | |
442 |
| - | |
443 |
| - | |
444 |
| - | |
445 |
| - | |
446 |
| - | |
447 | 427 |
| |
448 |
| - | |
| 428 | + | |
449 | 429 |
| |
450 | 430 |
| |
451 | 431 |
| |
| |||
464 | 444 |
| |
465 | 445 |
| |
466 | 446 |
| |
467 |
| - | |
468 |
| - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
469 | 450 |
| |
470 | 451 |
| |
471 | 452 |
| |
|
0 commit comments
Comments
(0)