Fossil

Check-in [353438a8]
Login

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

Overview
Comment:Short-circuit a rare pathological case in the diff generator to prevent it from taking too much time.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 353438a83bf862cb680b25f5c24f51f59faf39d0
User & Date: drh 2012-11-08 16:25:48
Context
2012-11-08
16:51
Properly escape spaces in URLs in an href attribute. check-in: cd8aad43 user: drh tags: trunk
16:25
Short-circuit a rare pathological case in the diff generator to prevent it from taking too much time. check-in: 353438a8 user: drh tags: trunk
16:09
Add a new test script that runs 10,000 web pages without valgrind looking for performance issues or fatal errors. Fix one incorrect SQL statement found by this script. Update the valgrind test script to run discovered web pages in a random order. check-in: a1064042 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diff.c.

987
988
989
990
991
992
993









994
995
996
997
998
999
1000
    memset(aM, 3, nRight);
    return aM;
  }
  if( nRight==0 ){
    memset(aM, 1, nLeft);
    return aM;
  }









  if( nRight < (sizeof(aBuf)/sizeof(aBuf[0]))-1 ){
    pToFree = 0;
    a = aBuf;
  }else{
    a = pToFree = fossil_malloc( sizeof(a[0])*(nRight+1) );
  }








>
>
>
>
>
>
>
>
>







987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
    memset(aM, 3, nRight);
    return aM;
  }
  if( nRight==0 ){
    memset(aM, 1, nLeft);
    return aM;
  }

  /* This algorithm is O(N**2).  So if N is too big, bail out with a
  ** simple (but stupid and ugly) result that doesn't take too long. */
  if( nLeft*nRight>100000 ){
    memset(aM, 3, nRight);
    memset(aM+nRight, 1, nLeft);
    return aM;
  }

  if( nRight < (sizeof(aBuf)/sizeof(aBuf[0]))-1 ){
    pToFree = 0;
    a = aBuf;
  }else{
    a = pToFree = fossil_malloc( sizeof(a[0])*(nRight+1) );
  }