Fossil SCM
Fix a potential sigfault that can occur in the graph generator if the child is older than its parent.
Commit
7503f9877998135ead928a96125bf322dc794b56
Parent
8474ca6747d54c7…
1 file changed
+3
-2
+3
-2
| --- src/graph.c | ||
| +++ src/graph.c | ||
| @@ -242,11 +242,11 @@ | ||
| 242 | 242 | assert( pPrior->idx > pCurrent->idx ); |
| 243 | 243 | assert( pCurrent->iRail<0 ); |
| 244 | 244 | pCurrent->iRail = iRail; |
| 245 | 245 | pCurrent->railInUse |= mask; |
| 246 | 246 | pPrior->aiRaiser[iRail] = pCurrent->idx; |
| 247 | - while( pPrior!=pCurrent ){ | |
| 247 | + while( pPrior->idx > pCurrent->idx ){ | |
| 248 | 248 | pPrior->railInUse |= mask; |
| 249 | 249 | pPrior = pPrior->pPrev; |
| 250 | 250 | assert( pPrior!=0 ); |
| 251 | 251 | } |
| 252 | 252 | if( pCurrent->pPrev ){ |
| @@ -314,10 +314,11 @@ | ||
| 314 | 314 | if( pRow->isDup ) continue; |
| 315 | 315 | if( pRow->nParent==0 ) continue; |
| 316 | 316 | pParent = hashFind(p, pRow->aParent[0]); |
| 317 | 317 | if( pParent==0 ) continue; |
| 318 | 318 | if( pParent->zBranch!=pRow->zBranch ) continue; |
| 319 | + if( pParent->idx <= pRow->idx ) continue; | |
| 319 | 320 | if( pRow->idxTop < pParent->idxTop ){ |
| 320 | 321 | pParent->pChild = pRow; |
| 321 | 322 | pParent->idxTop = pRow->idxTop; |
| 322 | 323 | } |
| 323 | 324 | } |
| @@ -390,11 +391,11 @@ | ||
| 390 | 391 | }else{ |
| 391 | 392 | inUse |= mask; |
| 392 | 393 | assignChildrenToRail(pRow); |
| 393 | 394 | } |
| 394 | 395 | if( pParent ){ |
| 395 | - for(pLoop=pParent; pLoop!=pRow; pLoop=pLoop->pPrev){ | |
| 396 | + for(pLoop=pParent; pLoop && pLoop!=pRow; pLoop=pLoop->pPrev){ | |
| 396 | 397 | pLoop->railInUse |= mask; |
| 397 | 398 | } |
| 398 | 399 | } |
| 399 | 400 | } |
| 400 | 401 | |
| 401 | 402 |
| --- src/graph.c | |
| +++ src/graph.c | |
| @@ -242,11 +242,11 @@ | |
| 242 | assert( pPrior->idx > pCurrent->idx ); |
| 243 | assert( pCurrent->iRail<0 ); |
| 244 | pCurrent->iRail = iRail; |
| 245 | pCurrent->railInUse |= mask; |
| 246 | pPrior->aiRaiser[iRail] = pCurrent->idx; |
| 247 | while( pPrior!=pCurrent ){ |
| 248 | pPrior->railInUse |= mask; |
| 249 | pPrior = pPrior->pPrev; |
| 250 | assert( pPrior!=0 ); |
| 251 | } |
| 252 | if( pCurrent->pPrev ){ |
| @@ -314,10 +314,11 @@ | |
| 314 | if( pRow->isDup ) continue; |
| 315 | if( pRow->nParent==0 ) continue; |
| 316 | pParent = hashFind(p, pRow->aParent[0]); |
| 317 | if( pParent==0 ) continue; |
| 318 | if( pParent->zBranch!=pRow->zBranch ) continue; |
| 319 | if( pRow->idxTop < pParent->idxTop ){ |
| 320 | pParent->pChild = pRow; |
| 321 | pParent->idxTop = pRow->idxTop; |
| 322 | } |
| 323 | } |
| @@ -390,11 +391,11 @@ | |
| 390 | }else{ |
| 391 | inUse |= mask; |
| 392 | assignChildrenToRail(pRow); |
| 393 | } |
| 394 | if( pParent ){ |
| 395 | for(pLoop=pParent; pLoop!=pRow; pLoop=pLoop->pPrev){ |
| 396 | pLoop->railInUse |= mask; |
| 397 | } |
| 398 | } |
| 399 | } |
| 400 | |
| 401 |
| --- src/graph.c | |
| +++ src/graph.c | |
| @@ -242,11 +242,11 @@ | |
| 242 | assert( pPrior->idx > pCurrent->idx ); |
| 243 | assert( pCurrent->iRail<0 ); |
| 244 | pCurrent->iRail = iRail; |
| 245 | pCurrent->railInUse |= mask; |
| 246 | pPrior->aiRaiser[iRail] = pCurrent->idx; |
| 247 | while( pPrior->idx > pCurrent->idx ){ |
| 248 | pPrior->railInUse |= mask; |
| 249 | pPrior = pPrior->pPrev; |
| 250 | assert( pPrior!=0 ); |
| 251 | } |
| 252 | if( pCurrent->pPrev ){ |
| @@ -314,10 +314,11 @@ | |
| 314 | if( pRow->isDup ) continue; |
| 315 | if( pRow->nParent==0 ) continue; |
| 316 | pParent = hashFind(p, pRow->aParent[0]); |
| 317 | if( pParent==0 ) continue; |
| 318 | if( pParent->zBranch!=pRow->zBranch ) continue; |
| 319 | if( pParent->idx <= pRow->idx ) continue; |
| 320 | if( pRow->idxTop < pParent->idxTop ){ |
| 321 | pParent->pChild = pRow; |
| 322 | pParent->idxTop = pRow->idxTop; |
| 323 | } |
| 324 | } |
| @@ -390,11 +391,11 @@ | |
| 391 | }else{ |
| 392 | inUse |= mask; |
| 393 | assignChildrenToRail(pRow); |
| 394 | } |
| 395 | if( pParent ){ |
| 396 | for(pLoop=pParent; pLoop && pLoop!=pRow; pLoop=pLoop->pPrev){ |
| 397 | pLoop->railInUse |= mask; |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | |
| 402 |