Fossil

Check-in [4d7f7e96]
Login

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

Overview
Comment:Prevent buffer overruns when trying to do side-by-side diff alignment of lines that contain non-UTF8 characters and a prefix match.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-1.28
Files: files | file ages | folders
SHA1:4d7f7e96d4ecbeca57f7ffd2e91e7f5ab243273a
User & Date: drh 2014-01-11 20:41:06
Context
2014-01-12
10:20
Fix tree-view JS error/warnings. check-in: 94fcef10 user: joel tags: branch-1.28
2014-01-11
20:41
Prevent buffer overruns when trying to do side-by-side diff alignment of lines that contain non-UTF8 characters and a prefix match. check-in: 4d7f7e96 user: drh tags: branch-1.28
18:29
Don't replace sqlite3_strglob with sqlglob: It's wrong because the return value is different. Since SQLite 3.8.2 is guaranteed to have sqlite3_strglob anyway, no need to worry. check-in: ddc93368 user: jan.nijtmans tags: branch-1.28
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diff.c.

801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
...
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
      p->zStart = zClassRm;
    }else{
      p->zStart = zClassChng;
    }
    p->iStart2 = nPrefix + aLCS[1];
    p->iEnd2 = nLeft - nSuffix;
    p->zStart2 = aLCS[3]==nRightDiff ? zClassRm : zClassChng;
    sbsSimplifyLine(p, zLeft+nPrefix);
    sbsWriteText(p, pLeft, SBS_TXTA);
    sbsWriteMarker(p, " | ", "|");
    sbsWriteLineno(p, lnRight, SBS_LNB);
    p->iStart = nPrefix;
    p->iEnd = nPrefix + aLCS[2];
    if( aLCS[0]==0 ){
      sbsShiftLeft(p, pRight->z);
................................................................................
      p->zStart = zClassAdd;
    }else{
      p->zStart = zClassChng;
    }
    p->iStart2 = nPrefix + aLCS[3];
    p->iEnd2 = nRight - nSuffix;
    p->zStart2 = aLCS[1]==nLeftDiff ? zClassAdd : zClassChng;
    sbsSimplifyLine(p, zRight+nPrefix);
    sbsWriteText(p, pRight, SBS_TXTB);
    return;
  }

  /* If all else fails, show a single big change between left and right */
  sbsWriteLineno(p, lnLeft, SBS_LNA);
  p->iStart2 = p->iEnd2 = 0;







|







 







|







801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
...
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
      p->zStart = zClassRm;
    }else{
      p->zStart = zClassChng;
    }
    p->iStart2 = nPrefix + aLCS[1];
    p->iEnd2 = nLeft - nSuffix;
    p->zStart2 = aLCS[3]==nRightDiff ? zClassRm : zClassChng;
    sbsSimplifyLine(p, zLeft);
    sbsWriteText(p, pLeft, SBS_TXTA);
    sbsWriteMarker(p, " | ", "|");
    sbsWriteLineno(p, lnRight, SBS_LNB);
    p->iStart = nPrefix;
    p->iEnd = nPrefix + aLCS[2];
    if( aLCS[0]==0 ){
      sbsShiftLeft(p, pRight->z);
................................................................................
      p->zStart = zClassAdd;
    }else{
      p->zStart = zClassChng;
    }
    p->iStart2 = nPrefix + aLCS[3];
    p->iEnd2 = nRight - nSuffix;
    p->zStart2 = aLCS[1]==nLeftDiff ? zClassAdd : zClassChng;
    sbsSimplifyLine(p, zRight);
    sbsWriteText(p, pRight, SBS_TXTB);
    return;
  }

  /* If all else fails, show a single big change between left and right */
  sbsWriteLineno(p, lnLeft, SBS_LNA);
  p->iStart2 = p->iEnd2 = 0;