Re: [sqlite] Crash inside sqlite3_step
I found that you are correct. I wasn't reading the valgrind log properly. Thank you. Kavita On 1/25/10 10:26 PM, "Dan Kennedy" wrote: > > On Jan 26, 2010, at 6:16 AM, Kavita Raghunathan wrote: > >> Following Sql query crashes in allocateCursor inside of sqlite3_step >> >> INSERT INTO EntityTbl (AttrName, AttrEnum, AttrType, AttrValue, >> ReadWrite, Entity_id) VALUES(Œimage_crc¹, 6008, 16, Œ0¹, 1, 34013184); >> >> I¹m not able to get an understanding of what I might be doing wrong. >> Please note: >> >> 1. I have successfully created EntityTbl >> 2. I have added n rows successfully into table this is row n+1 that >> causes a crash >> 3. I know previously this group asked me to use valgrind to see if >> the crash was elsewhere and I did that. I¹ve enclosed the results. > > The valgrind output seems to indicate the problem is not in SQLite, no? > Function get_default_database() has a buffer overrun in it. > >> >> Thanks, >> Kavita >> >> ==28525== Memcheck, a memory error detector >> ==28525== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward >> et al. >> ==28525== Using Valgrind-3.5.0 and LibVEX; rerun with -h for >> copyright info >> ==28525== Command: cm >> ==28525== >> updating hw address >> sh: ifconfig: command not found >> ==28525== Syscall param write(buf) points to uninitialised byte(s) >> ==28525==at 0x62A44B: ??? (in /lib/libpthread-2.5.so) >> ==28525==by 0x80661F3: unixWrite (in /home/kraghunathan/views/ >> sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x805F1A3: sqlite3OsWrite (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x8069E19: writeJournalHdr (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x806D416: pager_open_journal (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x806D4E1: sqlite3PagerBegin (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x8071BB3: sqlite3BtreeBeginTrans (in /home/ >> kraghunathan/views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x80852F5: sqlite3VdbeExec (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x808084F: sqlite3Step (in /home/kraghunathan/views/ >> sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x8080A00: sqlite3_step (in /home/kraghunathan/views/ >> sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x80C2866: sf_database_mgr::set_cache_size(sqlite3*, >> int) (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x80C2AF4: >> sf_database_mgr::create_database(sqlite3**, char const*) (in /home/ >> kraghunathan/views/sfdev-2.0/out/usr/bin/cm) >> ==28525== Address 0x40757b9 is 9 bytes inside a block of size 2,056 >> alloc'd >> ==28525==at 0x4005903: malloc (vg_replace_malloc.c:195) >> ==28525==by 0x805F746: sqlite3MemMalloc (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x8060062: mallocWithAlarm (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x806010A: sqlite3Malloc (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x80683CD: pcache1Alloc (in /home/kraghunathan/views/ >> sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x8068541: sqlite3PageMalloc (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x806BA08: sqlite3PagerSetPagesize (in /home/ >> kraghunathan/views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x80713A2: sqlite3BtreeSetPageSize (in /home/ >> kraghunathan/views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x80A3BF5: sqlite3Pragma (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x80BDA6A: yy_reduce (in /home/kraghunathan/views/ >> sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x80BE3CF: sqlite3Parser (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x80BF01E: sqlite3RunParser (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525== >> ==28525== Use of uninitialised value of size 4 >> ==28525==at 0x4007D3C: strcpy (mc_replace_strmem.c:303) >> ==28525==by 0x804FEB9: >> fls_entity::get_default_database(sf_db_tbl_t**) (in /home/ >> kraghunathan/views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x804B4E6: >> cm_entity_manager::update_entity_database(sf_entity*) (in /home/ >> kraghunathan/views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x804B601: >> cm_entity_manager::update_entity_database() (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x804BB59: >> cm_entity_manager::do_init_database(char*) (in /home/kraghunathan/ >> views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x804BCDC: cm_entity_manager::cm_entity_manager() >> (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) >> ==28525==by 0x80499FD: main (in /home/kraghunathan/views/ >> sfdev-2.0/out/usr/bin/cm) >> ==28525== >> ==28525== Invalid write of size 1 >> ==28525==at 0x4007D3C: strcpy (mc_replace_strmem.c:303) >> ==28525==by 0x804FEB9: >> fls_entity::get_def
Re: [sqlite] Crash inside sqlite3_step
On Jan 26, 2010, at 6:16 AM, Kavita Raghunathan wrote: > Following Sql query crashes in allocateCursor inside of sqlite3_step > > INSERT INTO EntityTbl (AttrName, AttrEnum, AttrType, AttrValue, > ReadWrite, Entity_id) VALUES(‘image_crc’, 6008, 16, ‘0’, 1, 34013184); > > I’m not able to get an understanding of what I might be doing wrong. > Please note: > > 1. I have successfully created EntityTbl > 2. I have added n rows successfully into table this is row n+1 that > causes a crash > 3. I know previously this group asked me to use valgrind to see if > the crash was elsewhere and I did that. I’ve enclosed the results. The valgrind output seems to indicate the problem is not in SQLite, no? Function get_default_database() has a buffer overrun in it. > > Thanks, > Kavita > > ==28525== Memcheck, a memory error detector > ==28525== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward > et al. > ==28525== Using Valgrind-3.5.0 and LibVEX; rerun with -h for > copyright info > ==28525== Command: cm > ==28525== > updating hw address > sh: ifconfig: command not found > ==28525== Syscall param write(buf) points to uninitialised byte(s) > ==28525==at 0x62A44B: ??? (in /lib/libpthread-2.5.so) > ==28525==by 0x80661F3: unixWrite (in /home/kraghunathan/views/ > sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x805F1A3: sqlite3OsWrite (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x8069E19: writeJournalHdr (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x806D416: pager_open_journal (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x806D4E1: sqlite3PagerBegin (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x8071BB3: sqlite3BtreeBeginTrans (in /home/ > kraghunathan/views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x80852F5: sqlite3VdbeExec (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x808084F: sqlite3Step (in /home/kraghunathan/views/ > sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x8080A00: sqlite3_step (in /home/kraghunathan/views/ > sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x80C2866: sf_database_mgr::set_cache_size(sqlite3*, > int) (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x80C2AF4: > sf_database_mgr::create_database(sqlite3**, char const*) (in /home/ > kraghunathan/views/sfdev-2.0/out/usr/bin/cm) > ==28525== Address 0x40757b9 is 9 bytes inside a block of size 2,056 > alloc'd > ==28525==at 0x4005903: malloc (vg_replace_malloc.c:195) > ==28525==by 0x805F746: sqlite3MemMalloc (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x8060062: mallocWithAlarm (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x806010A: sqlite3Malloc (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x80683CD: pcache1Alloc (in /home/kraghunathan/views/ > sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x8068541: sqlite3PageMalloc (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x806BA08: sqlite3PagerSetPagesize (in /home/ > kraghunathan/views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x80713A2: sqlite3BtreeSetPageSize (in /home/ > kraghunathan/views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x80A3BF5: sqlite3Pragma (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x80BDA6A: yy_reduce (in /home/kraghunathan/views/ > sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x80BE3CF: sqlite3Parser (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x80BF01E: sqlite3RunParser (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525== > ==28525== Use of uninitialised value of size 4 > ==28525==at 0x4007D3C: strcpy (mc_replace_strmem.c:303) > ==28525==by 0x804FEB9: > fls_entity::get_default_database(sf_db_tbl_t**) (in /home/ > kraghunathan/views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x804B4E6: > cm_entity_manager::update_entity_database(sf_entity*) (in /home/ > kraghunathan/views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x804B601: > cm_entity_manager::update_entity_database() (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x804BB59: > cm_entity_manager::do_init_database(char*) (in /home/kraghunathan/ > views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x804BCDC: cm_entity_manager::cm_entity_manager() > (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x80499FD: main (in /home/kraghunathan/views/ > sfdev-2.0/out/usr/bin/cm) > ==28525== > ==28525== Invalid write of size 1 > ==28525==at 0x4007D3C: strcpy (mc_replace_strmem.c:303) > ==28525==by 0x804FEB9: > fls_entity::get_default_database(sf_db_tbl_t**) (in /home/ > kraghunathan/views/sfdev-2.0/out/usr/bin/cm) > ==28525==by 0x804B4E6: > cm_entity_manager::update_entity_database(sf_entity*) (in /home/ > kraghunathan/v
[sqlite] Crash inside sqlite3_step
Following Sql query crashes in allocateCursor inside of sqlite3_step INSERT INTO EntityTbl (AttrName, AttrEnum, AttrType, AttrValue, ReadWrite, Entity_id) VALUES(‘image_crc’, 6008, 16, ‘0’, 1, 34013184); I’m not able to get an understanding of what I might be doing wrong. Please note: 1. I have successfully created EntityTbl 2. I have added n rows successfully into table this is row n+1 that causes a crash 3. I know previously this group asked me to use valgrind to see if the crash was elsewhere and I did that. I’ve enclosed the results. Thanks, Kavita ==28525== Memcheck, a memory error detector ==28525== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==28525== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info ==28525== Command: cm ==28525== updating hw address sh: ifconfig: command not found ==28525== Syscall param write(buf) points to uninitialised byte(s) ==28525==at 0x62A44B: ??? (in /lib/libpthread-2.5.so) ==28525==by 0x80661F3: unixWrite (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x805F1A3: sqlite3OsWrite (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x8069E19: writeJournalHdr (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x806D416: pager_open_journal (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x806D4E1: sqlite3PagerBegin (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x8071BB3: sqlite3BtreeBeginTrans (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80852F5: sqlite3VdbeExec (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x808084F: sqlite3Step (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x8080A00: sqlite3_step (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80C2866: sf_database_mgr::set_cache_size(sqlite3*, int) (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80C2AF4: sf_database_mgr::create_database(sqlite3**, char const*) (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525== Address 0x40757b9 is 9 bytes inside a block of size 2,056 alloc'd ==28525==at 0x4005903: malloc (vg_replace_malloc.c:195) ==28525==by 0x805F746: sqlite3MemMalloc (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x8060062: mallocWithAlarm (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x806010A: sqlite3Malloc (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80683CD: pcache1Alloc (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x8068541: sqlite3PageMalloc (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x806BA08: sqlite3PagerSetPagesize (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80713A2: sqlite3BtreeSetPageSize (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80A3BF5: sqlite3Pragma (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80BDA6A: yy_reduce (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80BE3CF: sqlite3Parser (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80BF01E: sqlite3RunParser (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525== ==28525== Use of uninitialised value of size 4 ==28525==at 0x4007D3C: strcpy (mc_replace_strmem.c:303) ==28525==by 0x804FEB9: fls_entity::get_default_database(sf_db_tbl_t**) (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x804B4E6: cm_entity_manager::update_entity_database(sf_entity*) (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x804B601: cm_entity_manager::update_entity_database() (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x804BB59: cm_entity_manager::do_init_database(char*) (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x804BCDC: cm_entity_manager::cm_entity_manager() (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80499FD: main (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525== ==28525== Invalid write of size 1 ==28525==at 0x4007D3C: strcpy (mc_replace_strmem.c:303) ==28525==by 0x804FEB9: fls_entity::get_default_database(sf_db_tbl_t**) (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x804B4E6: cm_entity_manager::update_entity_database(sf_entity*) (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x804B601: cm_entity_manager::update_entity_database() (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x804BB59: cm_entity_manager::do_init_database(char*) (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x804BCDC: cm_entity_manager::cm_entity_manager() (in /home/kraghunathan/views/sfdev-2.0/out/usr/bin/cm) ==28525==by 0x80499FD: main (in