Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DBD-PostgreSQL PGTableColumnInfo>>initializeFrom: crash scenario

2 views
Skip to first unread message

Mark Bratcher

unread,
Aug 30, 2015, 4:31:35 PM8/30/15
to bug-gnu-...@gnu.org
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).

0 new messages