Fossil

Check-in [791fd2fd]
Login

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

Overview
Comment:Detect infinite loops in the DELTA table and abort out of content_get() when they are found.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:791fd2fd68a61e095cb3ea0f025f92d3f8f11d1e
User & Date: drh 2012-08-23 20:56:34
Context
2012-08-23
21:15
Fix an off-by-one error in the version-3 clone protocol. This error might cause an incomplete and corrupt clone if a transfer block fills up just before sending the very last blob. check-in: 0db6f981 user: drh tags: trunk
20:56
Detect infinite loops in the DELTA table and abort out of content_get() when they are found. check-in: 791fd2fd user: drh tags: trunk
09:23
Added a maintenance reminder/potential fixme note. check-in: 4e66a969 user: stephan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/content.c.

267
268
269
270
271
272
273



274
275
276
277
278
279
280
    a[0] = rid;
    a[1] = nextRid;
    n = 1;
    while( !bag_find(&contentCache.inCache, nextRid)
        && (nextRid = findSrcid(nextRid))>0 ){
      n++;
      if( n>=nAlloc ){



        nAlloc = nAlloc*2 + 10;
        a = fossil_realloc(a, nAlloc*sizeof(a[0]));
      }
      a[n] = nextRid;
    }
    mx = n;
    rc = content_get(a[n], pBlob);







>
>
>







267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
    a[0] = rid;
    a[1] = nextRid;
    n = 1;
    while( !bag_find(&contentCache.inCache, nextRid)
        && (nextRid = findSrcid(nextRid))>0 ){
      n++;
      if( n>=nAlloc ){
        if( n>db_int(0, "SELECT max(rid) FROM blob") ){
          fossil_panic("infinite loop in DELTA table");
        }
        nAlloc = nAlloc*2 + 10;
        a = fossil_realloc(a, nAlloc*sizeof(a[0]));
      }
      a[n] = nextRid;
    }
    mx = n;
    rc = content_get(a[n], pBlob);