Fossil SCM
Guard against an infinite loop in certain pathological edit patterns
Commit
71fe590e99d933ec99b0ff52456a72e4997a47c703cfdf0d1e18309e184f48ef
Parent
91a3a600e689794…
1 file changed
+3
-1
+3
-1
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -570,10 +570,11 @@ | ||
| 570 | 570 | ForumThread *pThread; /* Thread structure */ |
| 571 | 571 | ForumPost *pSelect; /* Currently selected post, or NULL if none */ |
| 572 | 572 | ForumPost *p; /* Post iterator pointer */ |
| 573 | 573 | char *zQuery; /* Common query string */ |
| 574 | 574 | int iIndentScale = 4; /* Indent scale factor, measured in "ex" units */ |
| 575 | + int sid; /* Comparison serial ID */ | |
| 575 | 576 | |
| 576 | 577 | /* In raw mode, force unformatted display and disable history. */ |
| 577 | 578 | if( mode == FD_RAW ){ |
| 578 | 579 | bUnf = 1; |
| 579 | 580 | bHist = 0; |
| @@ -631,12 +632,13 @@ | ||
| 631 | 632 | /* Chronological mode: display posts (optionally including edits) in their |
| 632 | 633 | ** original commit order. */ |
| 633 | 634 | if( bHist ){ |
| 634 | 635 | p = p->pNext; |
| 635 | 636 | }else{ |
| 637 | + sid = p->sid; | |
| 636 | 638 | if( p->pEditHead ) p = p->pEditHead; |
| 637 | - do p = p->pNext; while( p && p->sid<=p->pPrev->sid ); | |
| 639 | + do p = p->pNext; while( p && p->sid<=sid ); | |
| 638 | 640 | if( p && p->pEditTail ) p = p->pEditTail; |
| 639 | 641 | } |
| 640 | 642 | }else if( bHist && p->pEditNext ){ |
| 641 | 643 | /* Hierarchical and single mode: display each post's edits in sequence. */ |
| 642 | 644 | p = p->pEditNext; |
| 643 | 645 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -570,10 +570,11 @@ | |
| 570 | ForumThread *pThread; /* Thread structure */ |
| 571 | ForumPost *pSelect; /* Currently selected post, or NULL if none */ |
| 572 | ForumPost *p; /* Post iterator pointer */ |
| 573 | char *zQuery; /* Common query string */ |
| 574 | int iIndentScale = 4; /* Indent scale factor, measured in "ex" units */ |
| 575 | |
| 576 | /* In raw mode, force unformatted display and disable history. */ |
| 577 | if( mode == FD_RAW ){ |
| 578 | bUnf = 1; |
| 579 | bHist = 0; |
| @@ -631,12 +632,13 @@ | |
| 631 | /* Chronological mode: display posts (optionally including edits) in their |
| 632 | ** original commit order. */ |
| 633 | if( bHist ){ |
| 634 | p = p->pNext; |
| 635 | }else{ |
| 636 | if( p->pEditHead ) p = p->pEditHead; |
| 637 | do p = p->pNext; while( p && p->sid<=p->pPrev->sid ); |
| 638 | if( p && p->pEditTail ) p = p->pEditTail; |
| 639 | } |
| 640 | }else if( bHist && p->pEditNext ){ |
| 641 | /* Hierarchical and single mode: display each post's edits in sequence. */ |
| 642 | p = p->pEditNext; |
| 643 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -570,10 +570,11 @@ | |
| 570 | ForumThread *pThread; /* Thread structure */ |
| 571 | ForumPost *pSelect; /* Currently selected post, or NULL if none */ |
| 572 | ForumPost *p; /* Post iterator pointer */ |
| 573 | char *zQuery; /* Common query string */ |
| 574 | int iIndentScale = 4; /* Indent scale factor, measured in "ex" units */ |
| 575 | int sid; /* Comparison serial ID */ |
| 576 | |
| 577 | /* In raw mode, force unformatted display and disable history. */ |
| 578 | if( mode == FD_RAW ){ |
| 579 | bUnf = 1; |
| 580 | bHist = 0; |
| @@ -631,12 +632,13 @@ | |
| 632 | /* Chronological mode: display posts (optionally including edits) in their |
| 633 | ** original commit order. */ |
| 634 | if( bHist ){ |
| 635 | p = p->pNext; |
| 636 | }else{ |
| 637 | sid = p->sid; |
| 638 | if( p->pEditHead ) p = p->pEditHead; |
| 639 | do p = p->pNext; while( p && p->sid<=sid ); |
| 640 | if( p && p->pEditTail ) p = p->pEditTail; |
| 641 | } |
| 642 | }else if( bHist && p->pEditNext ){ |
| 643 | /* Hierarchical and single mode: display each post's edits in sequence. */ |
| 644 | p = p->pEditNext; |
| 645 |