/ Check-in [12517d1b]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a potential memory leak in RBU if the rbu_fossil_delta() SQL function is misused. Misuse never happens in a working RBU system, so this is not a particularly important fix.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 12517d1b15da46bc90bd95bb9c161d7f2ecdd7f28b1b3a5ed4397939ef986061
User & Date: drh 2019-02-19 17:45:31
Context
2019-02-19
18:39
Add the fossildelta.c extension in ext/misc with implementations of the Fossil delta functions. check-in: b80cafa6 user: drh tags: trunk
17:45
Fix a potential memory leak in RBU if the rbu_fossil_delta() SQL function is misused. Misuse never happens in a working RBU system, so this is not a particularly important fix. check-in: 12517d1b user: drh tags: trunk
16:42
Fix an assert() that might not be true if the database file is corrupt. check-in: f2d400db user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to ext/rbu/sqlite3rbu.c.

680
681
682
683
684
685
686

687
688
689
690
691
692
693

  aOut = sqlite3_malloc(nOut+1);
  if( aOut==0 ){
    sqlite3_result_error_nomem(context);
  }else{
    nOut2 = rbuDeltaApply(aOrig, nOrig, aDelta, nDelta, aOut);
    if( nOut2!=nOut ){

      sqlite3_result_error(context, "corrupt fossil delta", -1);
    }else{
      sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
    }
  }
}








>







680
681
682
683
684
685
686
687
688
689
690
691
692
693
694

  aOut = sqlite3_malloc(nOut+1);
  if( aOut==0 ){
    sqlite3_result_error_nomem(context);
  }else{
    nOut2 = rbuDeltaApply(aOrig, nOrig, aDelta, nDelta, aOut);
    if( nOut2!=nOut ){
      sqlite3_free(aOut);
      sqlite3_result_error(context, "corrupt fossil delta", -1);
    }else{
      sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
    }
  }
}