patch for some more overruns; two to go - Mailing list pgsql-hackers
From | Maurice Gittens |
---|---|
Subject | patch for some more overruns; two to go |
Date | |
Msg-id | 199804011348.PAA30761@david.gits.nl Whole thread Raw |
List | pgsql-hackers |
Hi, After applying the following patch there remain two probable buffer overruns detected by Electric Fence during the regression test. I'll try find out what causes the remain two ones. This patch also corrects a typo in smgr.c. With regards from Maurice. --------- Patch starts here ---------- *** ./backend/catalog/pg_aggregate.c.orig Wed Apr 1 10:10:47 1998 --- ./backend/catalog/pg_aggregate.c Wed Apr 1 10:22:28 1998 *************** *** 78,83 **** --- 78,84 ---- Oid xret2 = InvalidOid; Oid fret = InvalidOid; Oid fnArgs[8]; + NameData aname; TupleDesc tupDesc; MemSet(fnArgs, 0, 8 * sizeof(Oid)); *************** *** 202,208 **** nulls[i] = ' '; values[i] = (Datum) NULL; } ! values[Anum_pg_aggregate_aggname - 1] = PointerGetDatum(aggName); values[Anum_pg_aggregate_aggowner - 1] = Int32GetDatum(GetUserId()); values[Anum_pg_aggregate_aggtransfn1 - 1] = --- 203,210 ---- nulls[i] = ' '; values[i] = (Datum) NULL; } ! namestrcpy(&aname, aggName); ! values[Anum_pg_aggregate_aggname - 1] = NameGetDatum(&aname); values[Anum_pg_aggregate_aggowner - 1] = Int32GetDatum(GetUserId()); values[Anum_pg_aggregate_aggtransfn1 - 1] = *** ./backend/catalog/pg_operator.c.orig Wed Apr 1 10:10:47 1998 --- ./backend/catalog/pg_operator.c Wed Apr 1 10:49:30 1998 *************** *** 19,24 **** --- 19,25 ---- #include <catalog/pg_proc.h> #include <utils/syscache.h> #include <utils/tqual.h> + #include <utils/builtins.h> #include <access/heapam.h> #include <catalog/catname.h> #include <catalog/pg_operator.h> *************** *** 229,234 **** --- 230,236 ---- Datum values[Natts_pg_operator]; char nulls[Natts_pg_operator]; Oid operatorObjectId; + NameData oname; TupleDesc tupDesc; /* ---------------- *************** *** 246,252 **** * ---------------- */ i = 0; ! values[i++] = PointerGetDatum(operatorName); values[i++] = Int32GetDatum(GetUserId()); values[i++] = (Datum) (uint16) 0; --- 248,255 ---- * ---------------- */ i = 0; ! namestrcpy(&oname, operatorName); ! values[i++] = NameGetDatum(&oname); values[i++] = Int32GetDatum(GetUserId()); values[i++] = (Datum) (uint16) 0; *************** *** 474,479 **** --- 477,483 ---- char *name[4]; Oid typeId[8]; int nargs; + NameData oname; TupleDesc tupDesc; static ScanKeyData opKey[3] = { *************** *** 608,614 **** * ---------------- */ i = 0; ! values[i++] = PointerGetDatum(operatorName); values[i++] = Int32GetDatum(GetUserId()); values[i++] = UInt16GetDatum(precedence); values[i++] = leftTypeName ? (rightTypeName ? 'b' : 'r') : 'l'; --- 612,619 ---- * ---------------- */ i = 0; ! namestrcpy(&oname, operatorName); ! values[i++] = NameGetDatum(&oname); values[i++] = Int32GetDatum(GetUserId()); values[i++] = UInt16GetDatum(precedence); values[i++] = leftTypeName ? (rightTypeName ? 'b' : 'r') : 'l'; *** ./backend/catalog/pg_proc.c.orig Wed Apr 1 10:10:47 1998 --- ./backend/catalog/pg_proc.c Wed Apr 1 10:26:58 1998 *************** *** 71,76 **** --- 71,77 ---- Oid relid; Oid toid; text *prosrctext; + NameData procname; TupleDesc tupDesc; /* ---------------- *************** *** 229,235 **** } i = 0; ! values[i++] = PointerGetDatum(procedureName); values[i++] = Int32GetDatum(GetUserId()); values[i++] = ObjectIdGetDatum(languageObjectId); --- 230,237 ---- } i = 0; ! namestrcpy(&procname, procedureName); ! values[i++] = NameGetDatum(&procname); values[i++] = Int32GetDatum(GetUserId()); values[i++] = ObjectIdGetDatum(languageObjectId); *** ./backend/catalog/pg_type.c.orig Wed Apr 1 10:10:47 1998 --- ./backend/catalog/pg_type.c Wed Apr 1 10:50:09 1998 *************** *** 160,165 **** --- 160,166 ---- Datum values[Natts_pg_type]; char nulls[Natts_pg_type]; Oid typoid; + NameData name; TupleDesc tupDesc; /* ---------------- *************** *** 177,183 **** * ---------------- */ i = 0; ! values[i++] = (Datum) typeName; /* 1 */ values[i++] = (Datum) InvalidOid; /* 2 */ values[i++] = (Datum) (int16) 0; /* 3 */ values[i++] = (Datum) (int16) 0; /* 4 */ --- 178,185 ---- * ---------------- */ i = 0; ! namestrcpy(&name, typeName); ! values[i++] = NameGetDatum(&name); /* 1 */ values[i++] = (Datum) InvalidOid; /* 2 */ values[i++] = (Datum) (int16) 0; /* 3 */ values[i++] = (Datum) (int16) 0; /* 4 */ *************** *** 315,325 **** char *procs[4]; bool defined; ItemPointerData itemPointerData; TupleDesc tupDesc; - Oid argList[8]; - NameData name; - static ScanKeyData typeKey[1] = { {0, Anum_pg_type_typname, NameEqualRegProcedure} --- 317,325 ---- char *procs[4]; bool defined; ItemPointerData itemPointerData; + NameData name; TupleDesc tupDesc; Oid argList[8]; static ScanKeyData typeKey[1] = { {0, Anum_pg_type_typname, NameEqualRegProcedure} *** ./backend/storage/smgr/smgr.c.orig Wed Apr 1 10:10:52 1998 --- ./backend/storage/smgr/smgr.c Wed Apr 1 10:33:01 1998 *************** *** 132,138 **** int fd; if ((fd = (*(smgrsw[which].smgr_create)) (reln)) < 0) ! elog(ERROR, "cannot open %s", &(reln->rd_rel->relname.data[0])); return (fd); --- 132,138 ---- int fd; if ((fd = (*(smgrsw[which].smgr_create)) (reln)) < 0) ! elog(ERROR, "cannot create %s", &(reln->rd_rel->relname.data[0])); return (fd);
pgsql-hackers by date: