Fossil

Check-in [fded1d05]
Login

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

Overview
Comment:Fixed modulo/divide by 0 in TH1, per ML bug report from Eduardo Morras.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:fded1d055f57430120e87df96e021c39d80a15ce
User & Date: stephan 2013-06-20 13:18:55
Original Comment: Fixed module/divide by 0 in TH1, per bug report from Eduardo Morras.
Context
2013-06-20
13:34
Allow 64-bit integers to be used in JSON on win32/win64. check-in: 928b26ab user: jan.nijtmans tags: trunk
13:22
Allow 64-bit integers to be used in JSON on win32/64 Closed-Leaf check-in: 50e8847d user: jan.nijtmans tags: 64bit-int-on-win
13:18
Fixed modulo/divide by 0 in TH1, per ML bug report from Eduardo Morras. check-in: fded1d05 user: stephan tags: trunk
11:46
Enhance the "fossil extra" and "fossil clean" commands to restrict output to files and directories named on the command-line. Enhancement request ticket [967cedbf200f7]. check-in: 39feb892 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/th.c.

1872
1873
1874
1875
1876
1877
1878





1879






1880

1881
1882
1883
1884
1885
1886
1887
      }  
    }

    if( rc==TH_OK && eArgType==ARG_INTEGER ){
      int iRes = 0;
      switch( pExpr->pOp->eOp ) {
        case OP_MULTIPLY:     iRes = iLeft*iRight;  break;





        case OP_DIVIDE:       iRes = iLeft/iRight;  break;






        case OP_MODULUS:      iRes = iLeft%iRight;  break;

        case OP_ADD:          iRes = iLeft+iRight;  break;
        case OP_SUBTRACT:     iRes = iLeft-iRight;  break;
        case OP_LEFTSHIFT:    iRes = iLeft<<iRight; break;
        case OP_RIGHTSHIFT:   iRes = iLeft>>iRight; break;
        case OP_LT:           iRes = iLeft<iRight;  break;
        case OP_GT:           iRes = iLeft>iRight;  break;
        case OP_LE:           iRes = iLeft<=iRight; break;







>
>
>
>
>
|
>
>
>
>
>
>
|
>







1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
      }  
    }

    if( rc==TH_OK && eArgType==ARG_INTEGER ){
      int iRes = 0;
      switch( pExpr->pOp->eOp ) {
        case OP_MULTIPLY:     iRes = iLeft*iRight;  break;
        case OP_DIVIDE:
          if(!iRight){
            Th_ErrorMessage(interp, "Divide by 0:", zLeft, nLeft);
            return TH_ERROR;
          }
          iRes = iLeft/iRight;
          break;
        case OP_MODULUS:
          if(!iRight){
            Th_ErrorMessage(interp, "Modulo by 0:", zLeft, nLeft);
            return TH_ERROR;
          }
          iRes = iLeft%iRight;
          break;
        case OP_ADD:          iRes = iLeft+iRight;  break;
        case OP_SUBTRACT:     iRes = iLeft-iRight;  break;
        case OP_LEFTSHIFT:    iRes = iLeft<<iRight; break;
        case OP_RIGHTSHIFT:   iRes = iLeft>>iRight; break;
        case OP_LT:           iRes = iLeft<iRight;  break;
        case OP_GT:           iRes = iLeft>iRight;  break;
        case OP_LE:           iRes = iLeft<=iRight; break;