Fossil SCM

Detect infinite loops in the DELTA table and abort out of content_get() when they are found.

drh 2012-08-23 20:56 trunk
Commit 791fd2fd68a61e095cb3ea0f025f92d3f8f11d1e
1 file changed +3
--- src/content.c
+++ src/content.c
@@ -269,10 +269,13 @@
269269
n = 1;
270270
while( !bag_find(&contentCache.inCache, nextRid)
271271
&& (nextRid = findSrcid(nextRid))>0 ){
272272
n++;
273273
if( n>=nAlloc ){
274
+ if( n>db_int(0, "SELECT max(rid) FROM blob") ){
275
+ fossil_panic("infinite loop in DELTA table");
276
+ }
274277
nAlloc = nAlloc*2 + 10;
275278
a = fossil_realloc(a, nAlloc*sizeof(a[0]));
276279
}
277280
a[n] = nextRid;
278281
}
279282
--- src/content.c
+++ src/content.c
@@ -269,10 +269,13 @@
269 n = 1;
270 while( !bag_find(&contentCache.inCache, nextRid)
271 && (nextRid = findSrcid(nextRid))>0 ){
272 n++;
273 if( n>=nAlloc ){
 
 
 
274 nAlloc = nAlloc*2 + 10;
275 a = fossil_realloc(a, nAlloc*sizeof(a[0]));
276 }
277 a[n] = nextRid;
278 }
279
--- src/content.c
+++ src/content.c
@@ -269,10 +269,13 @@
269 n = 1;
270 while( !bag_find(&contentCache.inCache, nextRid)
271 && (nextRid = findSrcid(nextRid))>0 ){
272 n++;
273 if( n>=nAlloc ){
274 if( n>db_int(0, "SELECT max(rid) FROM blob") ){
275 fossil_panic("infinite loop in DELTA table");
276 }
277 nAlloc = nAlloc*2 + 10;
278 a = fossil_realloc(a, nAlloc*sizeof(a[0]));
279 }
280 a[n] = nextRid;
281 }
282

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button