DBD-PostgreSQL PGTableColumnInfo>>initializeFrom: crash scenario
Mark Bratcher <[email protected]> Sun, 30 Aug 2015 16:31:08 -0400
| Newsgroups | gmane.comp.lang.smalltalk.gnu.bugs |
|---|---|
| Message-ID | <[email protected]> |
The `initializeFrom:` selector for the `PGTableColumnInfo` class doesn't
check for nil values for the `prec` and `scale` values. Therefore, under
some conditions, the following will crash:
initializeFrom: aRow [
| prec radix scale |
name := aRow atIndex: 1.
type := aRow atIndex: 2.
size := aRow atIndex: 3.
prec := aRow atIndex: 4.
radix := aRow atIndex: 5.
scale := aRow atIndex: 6.
nullable := (aRow atIndex: 7) = 'YES'.
index := aRow atIndex: 8.
radix = 2 ifTrue: [ "if radix is nil, this crashes
prec := (prec / 3.32192809) ceiling."if prec is nil, this
crashes"
scale := (scale / 3.32192809) ceiling ]."if scale is nil,
this crashes"
This method needs to check wither there are actually values available at
`aRow` at indices 4, 5, and 6. Other indices might also need to be
checked, but I have not encountered these as faults (yet).