Groups | Search | Server Info | Login | Register


Groups > gnu.smalltalk.bug > #1

DBD-PostgreSQL PGTableColumnInfo>>initializeFrom: crash scenario

From Mark Bratcher <mdbratch@gmail.com>
Newsgroups gnu.smalltalk.bug
Subject DBD-PostgreSQL PGTableColumnInfo>>initializeFrom: crash scenario
Date 2015-08-30 16:31 -0400
Message-ID <mailman.217.1440966694.19560.bug-gnu-smalltalk@gnu.org> (permalink)

Show all headers | View raw


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

Back to gnu.smalltalk.bug | Next | Find similar


Thread

DBD-PostgreSQL PGTableColumnInfo>>initializeFrom: crash scenario Mark Bratcher <mdbratch@gmail.com> - 2015-08-30 16:31 -0400

csiph-web