SQLite Forum

Timeline
Login

6 forum posts by user zxc8263735

2020-05-27
14:24 Edit: memory leaks in sqlite3.c:23618 (artifact: 751bdb04f5 user: zxc8263735)
Version: SQLite version 3.32.0 2020-04-06 18:16:31

OS: Ubuntu 16.04 LTS

POC: https://github.com/puppet-meteor/NLP_POC/blob/master/sqlite3/POC_6_000667

cmd: ./sqlite3 < POC

ASAN log:

=================================================================
==29374==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 248 byte(s) in 1 object(s) allocated from:

    #0 0x7ffff6f02961 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98961)
    #1 0x4617f3 in sqlite3MemRealloc ../sqlite3.c:23618
    #2 0x46309a in sqlite3Realloc ../sqlite3.c:27652
    #3 0x4631a3 in sqlite3_realloc64 ../sqlite3.c:27684
    #4 0x469423 in sqlite3StrAccumEnlarge ../sqlite3.c:28918
    #5 0x4697cc in enlargeAndAppend ../sqlite3.c:28955
    #6 0x46991a in sqlite3_str_append ../sqlite3.c:28972
    #7 0x464d01 in sqlite3_str_vappendf ../sqlite3.c:28249
    #8 0x46a7d6 in sqlite3_vmprintf ../sqlite3.c:29157
    #9 0x46a9af in sqlite3_mprintf ../sqlite3.c:29173
    #10 0x448947 in do_meta_command ../shell.c:15871
    #11 0x455fb1 in process_input ../shell.c:18527
    #12 0x4588e6 in main ../shell.c:19330
    #13 0x7ffff617c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 248 byte(s) leaked in 1 allocation(s).
14:23 Edit: memory leaks in sqlite3.c:23545 (artifact: c5bcdc036d user: zxc8263735)
Version: SQLite version 3.32.0 2020-04-06 18:16:31

OS: Ubuntu 16.04 LTS

POC:  https://github.com/puppet-meteor/NLP_POC/blob/master/sqlite3/POC_6_000613

cmd: ./sqlite3 < POC 

ASAN log:

=================================================================
==1102==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:

    #0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4616f5 in sqlite3MemMalloc ../sqlite3.c:23545
    #2 0x4626d9 in mallocWithAlarm ../sqlite3.c:27427
    #3 0x46281e in sqlite3Malloc ../sqlite3.c:27457
    #4 0x462faf in sqlite3Realloc ../sqlite3.c:27627
    #5 0x4631a3 in sqlite3_realloc64 ../sqlite3.c:27684
    #6 0x43a5e9 in import_append_char ../shell.c:13151
    #7 0x44b2b5 in do_meta_command ../shell.c:16340
    #8 0x455fb1 in process_input ../shell.c:18527
    #9 0x4588e6 in main ../shell.c:19330
    #10 0x7ffff617c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 112 byte(s) leaked in 1 allocation(s)
06:07 Reply: memory leaks in sqlite3.c:23545 (artifact: 2f37a24393 user: zxc8263735)

the the ASAN logs on the state-of-the-art version 3.32.1 2020-05-25 16:19:56 are as follows:

==2164==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 104 byte(s) in 1 object(s) allocated from:

#0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x462874 in sqlite3MemMalloc /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:23627
#2 0x4637ab in mallocWithAlarm /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:27519
#3 0x4638f0 in sqlite3Malloc /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:27549
#4 0x464081 in sqlite3Realloc /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:27719
#5 0x46423e in sqlite3_realloc64 /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:27778
#6 0x43b0b2 in import_append_char /data3/ASAN2/sqlite-src-3320100/ASAN/shell.c:13283
#7 0x44bf9c in do_meta_command /data3/ASAN2/sqlite-src-3320100/ASAN/shell.c:16507
#8 0x457078 in process_input /data3/ASAN2/sqlite-src-3320100/ASAN/shell.c:18718
#9 0x459a68 in main /data3/ASAN2/sqlite-src-3320100/ASAN/shell.c:19529
#10 0x7ffff648582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 104 byte(s) leaked in 1 allocation(s).

The relevant codes in sqlite3.c:

static void *sqlite3MemMalloc(int nByte){
#ifdef SQLITE_MALLOCSIZE
  void *p;
  testcase( ROUND8(nByte)==nByte );
  p = SQLITE_MALLOC( nByte );                  \\ line 23627
  if( p==0 ){
    testcase( sqlite3GlobalConfig.xLog!=0 );
    sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
  }
  return p;
#else
  sqlite3_int64 *p;
  assert( nByte>0 );
  testcase( ROUND8(nByte)!=nByte );
  p = SQLITE_MALLOC( nByte+8 );
  if( p ){
    p[0] = nByte;
    p++;
  }else{
    testcase( sqlite3GlobalConfig.xLog!=0 );
    sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
  }
  return (void *)p;
#endif
}
06:03 Reply: memory leaks in sqlite3.c:23618 (artifact: 3b8d414fb9 user: zxc8263735)

Hi, the the ASAN logs on the state-of-the-art version 3.32.1 2020-05-25 16:19:56 are as follows:

==40745==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 240 byte(s) in 1 object(s) allocated from:

#0 0x7ffff6f02961 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98961)
#1 0x4628f7 in sqlite3MemRealloc /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:23697
#2 0x46416c in sqlite3Realloc /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:27744
#3 0x46a494 in sqlite3StrAccumEnlarge /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:29026
#4 0x46a83d in enlargeAndAppend /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:29063
#5 0x46a98b in sqlite3_str_append /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:29080
#6 0x465d5c in sqlite3_str_vappendf /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:28350
#7 0x46b847 in sqlite3_vmprintf /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:29265
#8 0x46ba20 in sqlite3_mprintf /data3/ASAN2/sqlite-src-3320100/ASAN/sqlite3.c:29281
#9 0x4493a6 in do_meta_command /data3/ASAN2/sqlite-src-3320100/ASAN/shell.c:16014
#10 0x457078 in process_input /data3/ASAN2/sqlite-src-3320100/ASAN/shell.c:18718
#11 0x459a68 in main /data3/ASAN2/sqlite-src-3320100/ASAN/shell.c:19529
#12 0x7ffff648582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 240 byte(s) leaked in 1 allocation(s).

The relevant codes in sqlite3.c:

static void *sqlite3MemRealloc(void *pPrior, int nByte){
#ifdef SQLITE_MALLOCSIZE
  void *p = SQLITE_REALLOC(pPrior, nByte);                //line 23697
  if( p==0 ){
    testcase( sqlite3GlobalConfig.xLog!=0 );
    sqlite3_log(SQLITE_NOMEM,
      "failed memory resize %u to %u bytes",
      SQLITE_MALLOCSIZE(pPrior), nByte);
  }
  return p;
#else
  sqlite3_int64 *p = (sqlite3_int64*)pPrior;
  assert( pPrior!=0 && nByte>0 );
  assert( nByte==ROUND8(nByte) ); 
  p--;
  p = SQLITE_REALLOC(p, nByte+8 );
  if( p ){
    p[0] = nByte;
    p++;
  }else{
    testcase( sqlite3GlobalConfig.xLog!=0 );
    sqlite3_log(SQLITE_NOMEM,
      "failed memory resize %u to %u bytes",
      sqlite3MemSize(pPrior), nByte);
  }
  return (void*)p;
#endif
}
2020-05-26
07:10 Post: memory leaks in sqlite3.c:23618 (artifact: 27654de3a6 user: zxc8263735)

Version: SQLite version 3.32.0 2020-04-06 18:16:31

OS: Ubuntu 16.04 LTS

POC: https://github.com/puppet-meteor/NLP_POC/blob/master/sqlite3/POC_6_000667

cmd: ./sqlite3 < POC

ASAN log:

==29374==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 248 byte(s) in 1 object(s) allocated from:

#0 0x7ffff6f02961 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98961)
#1 0x4617f3 in sqlite3MemRealloc ../sqlite3.c:23618
#2 0x46309a in sqlite3Realloc ../sqlite3.c:27652
#3 0x4631a3 in sqlite3_realloc64 ../sqlite3.c:27684
#4 0x469423 in sqlite3StrAccumEnlarge ../sqlite3.c:28918
#5 0x4697cc in enlargeAndAppend ../sqlite3.c:28955
#6 0x46991a in sqlite3_str_append ../sqlite3.c:28972
#7 0x464d01 in sqlite3_str_vappendf ../sqlite3.c:28249
#8 0x46a7d6 in sqlite3_vmprintf ../sqlite3.c:29157
#9 0x46a9af in sqlite3_mprintf ../sqlite3.c:29173
#10 0x448947 in do_meta_command ../shell.c:15871
#11 0x455fb1 in process_input ../shell.c:18527
#12 0x4588e6 in main ../shell.c:19330
#13 0x7ffff617c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 248 byte(s) leaked in 1 allocation(s).

07:08 Post: memory leaks in sqlite3.c:23545 (artifact: adb17d6289 user: zxc8263735)

Version: SQLite version 3.32.0 2020-04-06 18:16:31

OS: Ubuntu 16.04 LTS

POC: https://github.com/puppet-meteor/NLP_POC/blob/master/sqlite3/POC_6_000613

cmd: ./sqlite3 < POC

ASAN log:

==1102==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:

#0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x4616f5 in sqlite3MemMalloc ../sqlite3.c:23545
#2 0x4626d9 in mallocWithAlarm ../sqlite3.c:27427
#3 0x46281e in sqlite3Malloc ../sqlite3.c:27457
#4 0x462faf in sqlite3Realloc ../sqlite3.c:27627
#5 0x4631a3 in sqlite3_realloc64 ../sqlite3.c:27684
#6 0x43a5e9 in import_append_char ../shell.c:13151
#7 0x44b2b5 in do_meta_command ../shell.c:16340
#8 0x455fb1 in process_input ../shell.c:18527
#9 0x4588e6 in main ../shell.c:19330
#10 0x7ffff617c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 112 byte(s) leaked in 1 allocation(s)