tux21b/gocql — pull request #13 by nemothekid (2013-05-19 04:25:27+00:00)
Title: Fix improper cast of <row_count> from int64 (on some systems) to int32

This possibly only effects 64 bit builds.

rows.Next() crashes if a column value is null.
n := int32(binary.BigEndian.Uint32(r.body))
The issue is here:

```n := int(binary.BigEndian.Uint32(r.body))```

binary.BigEndian.Uint32(r.body) is casted as an int64, and as such the value of length of the column value is interpreted as 4294967295 instead of -1. This commit changes the line to

```n := int32(binary.BigEndian.Uint32(r.body))```

This commit also includes an test. Without the fix, the test should return

```
$ go test -timeout 60s github.com/channelmeter/gocql
--- FAIL: TestNullColumnValues (0.07 seconds)
panic: runtime error: slice bounds out of range [recovered]
panic: runtime error: slice bounds out of range
```