forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit04cee8f
committed
Fix several one-byte buffer over-reads in to_number
Several places in NUM_numpart_from_char(), which is called from the SQLfunction to_number(text, text), could accidentally read one byte pastthe end of the input buffer (which comes from the input text datum andis not null-terminated).1. One leading space character would be skipped, but there was no check that the input was at least one byte long. This does not happen in practice, but for defensiveness, add a check anyway.2. Commit4a3a1e2 apparently accidentally doubled that code that skips one space character (so that two spaces might be skipped), but there was no overflow check before skipping the second byte. Fix by removing that duplicate code.3. A logic error would allow a one-byte over-read when looking for a trailing sign (S) placeholder.In each case, the extra byte cannot be read out directly, but looking atit might cause a crash.The third item was discovered by Piotr Stefaniak, the first two werefound and analyzed by Tom Lane and Peter Eisentraut.1 parent4da812f commit04cee8f
1 file changed
+4
-4
lines changedLines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4173 | 4173 |
| |
4174 | 4174 |
| |
4175 | 4175 |
| |
4176 |
| - | |
4177 |
| - | |
4178 |
| - | |
4179 | 4176 |
| |
4180 | 4177 |
| |
4181 | 4178 |
| |
| 4179 | + | |
| 4180 | + | |
| 4181 | + | |
4182 | 4182 |
| |
4183 | 4183 |
| |
4184 | 4184 |
| |
| |||
4316 | 4316 |
| |
4317 | 4317 |
| |
4318 | 4318 |
| |
4319 |
| - | |
| 4319 | + | |
4320 | 4320 |
| |
4321 | 4321 |
| |
4322 | 4322 |
| |
|
0 commit comments
Comments
(0)