zoukankan      html  css  js  c++  java
  • Indy接收邮件可能发生range check error错误的修正

    使用D2010,接收邮件时有时会发生range check error的错误,而foxmail则可以正常接收,估计是indy本身的bug,追踪了一下,发现错误出现在IdCoder3to4.pas中的第277行:

    Result[LOutPos]     := (FDecodeTable[LInBytes[0]] shl 2) or ((FDecodeTable[LInBytes[1]] shr 4) and 3);
    抱着试试看的方式google了一下,在Embarcdero的论坛上竟然有人提这个bug了:

    https://forums.embarcadero.com/message.jspa?messageID=192364

    内容如下:

    In \Protocols\IdCoder3to4.pas line 277

         // Reduce to 3 bytes
         Result[LOutPos]     := (FDecodeTable[LInBytes[0]] shl 2) or ((FDecodeTable[LInBytes[1]] shr 4) and 3);
         Result[LOutPos + 1] := ((FDecodeTable[LInBytes[1]] and 15) shl 4) or ((FDecodeTable[LInBytes[2]] shr 2) and 15);
         Result[LOutPos + 2] := ((FDecodeTable[LInBytes[2]] and 3) shl 6) or (FDecodeTable[LInBytes[3]] and 63);
    


    When the base64 data contains, for whatever reason, garbage (for instance
    a space as first character) above code will generate a range-check error.

    In case of a space FDecodeTable[LInBytes[0]] will return 255, which is
    then "shifted" by two times add eax, eax.

    Suggested change:
         // Reduce to 3 bytes
         Result[LOutPos]     := ((FDecodeTable[LInBytes[0]] and 63) shl 2) or ((FDecodeTable[LInBytes[1]] shr 4) and 3);
    ...
    
    Thanks, I have checked it in.

    --
    Remy Lebeau (TeamB)
     
    可能在下个版本中能修正这个问题.
  • 相关阅读:
    RIGHT JOIN 关键字
    LEFT JOIN 关键字
    INNER JOIN 关键字
    连接(JOIN)
    别名
    BETWEEN 操作符
    IN 操作符
    通配符
    LIKE 操作符
    LIMIT 子句
  • 原文地址:https://www.cnblogs.com/GarfieldTom/p/1632514.html
Copyright © 2011-2022 走看看