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)
     
    可能在下个版本中能修正这个问题.
  • 相关阅读:
    yml 配置文件注入
    STS 自动生成 getter 和 setter
    maven build 失败
    navicat 使用
    STS 设置 注解提示
    windows下安装Mysql
    安装 mysql
    用Navicat Premium 操作MySQL数据库
    渐变显示渐变消失的BackgroundView
    基于dispatch_after封装YXTimer
  • 原文地址:https://www.cnblogs.com/GarfieldTom/p/1632514.html
Copyright © 2011-2022 走看看