forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita0bff38
committed
ecpg: Fix out-of-bound read in DecodeDateTime()
It was possible for the code to read out-of-bound data from the"day_tab" table with some crafted input data. Let's treat these asinvalid input as the month number is incorrect.A test is added to test this case with a check on the errno returned bythe decoding routine. A test close to the new one added in this commitwas testing for a failure, but did not look at the errno generated, solet's use this commit to also change it, adding a check on the errnoreturned by DecodeDateTime().Like the other test scripts, dt_test should likely be expanded toinclude more checks based on the errnos generated in these code paths.This is left as future work.This issue exists since2e6f975, so backpatch all the way down.Reported-by: Pavel NekrasovAuthor: Bruce Momjian, Pavel NekrasovDiscussion:https://postgr.es/m/18614-6bbe00117352309e@postgresql.orgBackpatch-through: 121 parentce207d2 commita0bff38
File tree
5 files changed
+109
-48
lines changed- src/interfaces/ecpg
- pgtypeslib
- test
- expected
- pgtypeslib
5 files changed
+109
-48
lines changedLines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2327 | 2327 |
| |
2328 | 2328 |
| |
2329 | 2329 |
| |
2330 |
| - | |
2331 |
| - | |
| 2330 | + | |
| 2331 | + | |
2332 | 2332 |
| |
2333 |
| - | |
| 2333 | + | |
2334 | 2334 |
| |
2335 | 2335 |
| |
2336 | 2336 |
| |
|
Lines changed: 53 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| 14 | + | |
14 | 15 |
| |
15 | 16 |
| |
16 | 17 |
| |
| |||
22 | 23 |
| |
23 | 24 |
| |
24 | 25 |
| |
25 |
| - | |
| 26 | + | |
26 | 27 |
| |
27 | 28 |
| |
| 29 | + | |
| 30 | + | |
28 | 31 |
| |
29 | 32 |
| |
30 | 33 |
| |
| |||
34 | 37 |
| |
35 | 38 |
| |
36 | 39 |
| |
37 |
| - | |
| 40 | + | |
38 | 41 |
| |
39 | 42 |
| |
40 |
| - | |
| 43 | + | |
41 | 44 |
| |
42 | 45 |
| |
43 |
| - | |
| 46 | + | |
44 | 47 |
| |
45 | 48 |
| |
46 |
| - | |
| 49 | + | |
47 | 50 |
| |
48 | 51 |
| |
49 |
| - | |
| 52 | + | |
50 | 53 |
| |
51 | 54 |
| |
52 | 55 |
| |
| |||
57 | 60 |
| |
58 | 61 |
| |
59 | 62 |
| |
60 |
| - | |
| 63 | + | |
61 | 64 |
| |
62 | 65 |
| |
63 |
| - | |
| 66 | + | |
64 | 67 |
| |
65 | 68 |
| |
66 |
| - | |
| 69 | + | |
67 | 70 |
| |
68 | 71 |
| |
69 |
| - | |
| 72 | + | |
70 | 73 |
| |
71 | 74 |
| |
72 |
| - | |
| 75 | + | |
73 | 76 |
| |
74 | 77 |
| |
75 |
| - | |
| 78 | + | |
76 | 79 |
| |
77 | 80 |
| |
78 |
| - | |
| 81 | + | |
79 | 82 |
| |
80 | 83 |
| |
81 |
| - | |
| 84 | + | |
82 | 85 |
| |
83 | 86 |
| |
84 |
| - | |
| 87 | + | |
85 | 88 |
| |
86 | 89 |
| |
87 | 90 |
| |
| |||
92 | 95 |
| |
93 | 96 |
| |
94 | 97 |
| |
95 |
| - | |
| 98 | + | |
96 | 99 |
| |
97 | 100 |
| |
98 |
| - | |
| 101 | + | |
99 | 102 |
| |
100 | 103 |
| |
101 | 104 |
| |
| |||
105 | 108 |
| |
106 | 109 |
| |
107 | 110 |
| |
108 |
| - | |
| 111 | + | |
109 | 112 |
| |
110 | 113 |
| |
111 |
| - | |
| 114 | + | |
112 | 115 |
| |
113 | 116 |
| |
114 | 117 |
| |
| |||
263 | 266 |
| |
264 | 267 |
| |
265 | 268 |
| |
| 269 | + | |
| 270 | + | |
266 | 271 |
| |
267 | 272 |
| |
268 | 273 |
| |
269 | 274 |
| |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
270 | 282 |
| |
271 | 283 |
| |
272 | 284 |
| |
| |||
453 | 465 |
| |
454 | 466 |
| |
455 | 467 |
| |
456 |
| - | |
| 468 | + | |
457 | 469 |
| |
458 | 470 |
| |
459 |
| - | |
| 471 | + | |
460 | 472 |
| |
461 | 473 |
| |
462 |
| - | |
| 474 | + | |
463 | 475 |
| |
464 | 476 |
| |
465 |
| - | |
| 477 | + | |
466 | 478 |
| |
467 | 479 |
| |
468 | 480 |
| |
469 | 481 |
| |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + |
Lines changed: 21 additions & 21 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 |
| |
9 |
| - | |
| 9 | + | |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 |
| - | |
| 15 | + | |
16 | 16 |
| |
17 |
| - | |
| 17 | + | |
18 | 18 |
| |
19 |
| - | |
| 19 | + | |
20 | 20 |
| |
21 |
| - | |
| 21 | + | |
22 | 22 |
| |
23 |
| - | |
| 23 | + | |
24 | 24 |
| |
25 |
| - | |
| 25 | + | |
26 | 26 |
| |
27 |
| - | |
| 27 | + | |
28 | 28 |
| |
29 |
| - | |
| 29 | + | |
30 | 30 |
| |
31 |
| - | |
| 31 | + | |
32 | 32 |
| |
33 |
| - | |
| 33 | + | |
34 | 34 |
| |
35 |
| - | |
| 35 | + | |
36 | 36 |
| |
37 |
| - | |
| 37 | + | |
38 | 38 |
| |
39 |
| - | |
| 39 | + | |
40 | 40 |
| |
41 |
| - | |
| 41 | + | |
42 | 42 |
| |
43 |
| - | |
| 43 | + | |
44 | 44 |
| |
45 |
| - | |
| 45 | + | |
46 | 46 |
| |
47 | 47 |
| |
48 | 48 |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
| 23 | + | |
| 24 | + | |
24 | 25 |
| |
25 | 26 |
| |
26 | 27 |
| |
|
Lines changed: 30 additions & 0 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 | 9 |
| |
9 | 10 |
| |
| 11 | + | |
| 12 | + | |
10 | 13 |
| |
11 | 14 |
| |
12 | 15 |
| |
| |||
189 | 192 |
| |
190 | 193 |
| |
191 | 194 |
| |
| 195 | + | |
| 196 | + | |
192 | 197 |
| |
193 | 198 |
| |
194 | 199 |
| |
195 | 200 |
| |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
196 | 208 |
| |
197 | 209 |
| |
198 | 210 |
| |
| |||
383 | 395 |
| |
384 | 396 |
| |
385 | 397 |
| |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + |
0 commit comments
Comments
(0)