bug-gnu-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DBD-PostgreSQL PGTableColumnInfo>>initializeFrom: crash scenario


From: Mark Bratcher
Subject: DBD-PostgreSQL PGTableColumnInfo>>initializeFrom: crash scenario
Date: Sun, 30 Aug 2015 16:31:08 -0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

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).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]