Bug #1103 Updated: segfault in dbmfetch() or dbmfirstkey)(
| From: | Bug Database | Date: | Mon, 04 Oct 1999 03:03:18 +0000 |
| Subject: | Bug #1103 Updated: segfault in dbmfetch() or dbmfirstkey)( | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-11489@lists.php.net to get a copy of this message | ||
ID: 1103
Updated by: jah
Reported By: morrilie@hotmail.com
Status: Closed
Bug Type: DBM related
Assigned To: jah
Comments:
This seems to be a bug in gcc (at least in version 2.7.2). If you want to
test it, compile the following code with gcc 2.7.2 both with -fomit-frame-pointer
and without. With -fomit-frame-pointer, it will segfault. At least on my
Linux box.
#include <stdio.h>
#include <gdbm.h>
int main(int argc, char **argv) {
GDBM_FILE db;
datum key, val;
char* keystr = "key";
char* valstr = "value";
key.dptr = keystr;
key.dsize = 3;
val.dptr = valstr;
val.dsize = 5;
if ((db = gdbm_open("destroyme", 512, GDBM_WRCREAT, 0666, NULL)) != NULL) {
if (!gdbm_store(db, key, val, GDBM_REPLACE)) {
val = gdbm_fetch(db, key);
printf("%u %s\n", val.dsize, val.dptr);
gdbm_close(db);
return 0;
}
printf("Couldn't store key!\n");
gdbm_close(db);
return 2;
}
printf("Couldn't open db!\n");
return 1;
}
Full Bug description available at: http://bugs.php.net/?id=1103