BUG #4743: potential bug between int and uint - Mailing list pgsql-bugs

From MATSUDA, Daiki
Subject BUG #4743: potential bug between int and uint
Date
Msg-id 200903310557.n2V5vSNh030035@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4743: potential bug between int and uint
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4743
Logged by:          MATSUDA, Daiki
Email address:      d.matuda@gmail.com
PostgreSQL version: 8.3.6
Operating system:   Linux
Description:        potential bug between int and uint
Details:

diff -uNrp ./src/backend/storage/ipc/procarray.c.bk
./src/backend/storage/ipc/procarray.c
--- ./src/backend/storage/ipc/procarray.c.bk    2009-03-05
10:23:03.000000000 +0900
+++ ./src/backend/storage/ipc/procarray.c       2009-03-05
10:25:20.000000000 +0900
@@ -662,8 +662,8 @@ GetSnapshotData(Snapshot snapshot, bool
        TransactionId xmax;
        TransactionId globalxmin;
        int                     index;
-       int                     count = 0;
-       int                     subcount = 0;
+       uint32          count = 0;
+       int32           subcount = 0;

        Assert(snapshot != NULL);

because uint32 xcnt and int32 subxcnt in Snapshot structure, same as struct
SnapshotData, is declared. and
    snapshot->xcnt = count;
    snapshot->subxcnt = subcount;
are written in GetSnapshotData() in procarray.c. It is a potential bug.

pgsql-bugs by date:

Previous
From: "Slava Moudry"
Date:
Subject: BUG #4742: wrong resultset instead of syntax error
Next
From: Heikki Linnakangas
Date:
Subject: Re: BUG #4742: wrong resultset instead of syntax error