Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Internet/Indy    [ Add a report in this area ]  
Report #:  85433   Status: Closed
delphi 2010 indy10 IdCoderMIME.pas bug
Project:  Delphi Build #:  14.0.3615.26342
Version:    14.0 Submitted By:   wb fang
Report Type:  Crash / Data loss / Total failure Date Reported:  6/14/2010 8:33:11 AM
Severity:    Critical / Show Stopper Last Updated: 8/24/2012 4:02:54 PM
Platform:    All platforms Internal Tracking #:  
Resolution: Third Party (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Sorry, My English is not good ,So I Paste Code ,See my change

procedure TIdDecoderMIMELineByLine.DecodeEnd;
var
  LStream: TMemoryStream;
  LPos: Integer;
begin
  if Length(FLeftFromLastTime) > 0 then begin
    LPos := Length(FLeftFromLastTime)+1;
    SetLength(FLeftFromLastTime, 4);
    while LPos <= 4 do begin
      //I change to
      FLeftFromLastTime[LPos-1] := Ord(FFillChar);      
      //old code
      //FLeftFromLastTime[LPos] := Ord(FFillChar);
      Inc(LPos);
    end;
    LStream := TMemoryStream.Create;
    try
      WriteTIdBytesToStream(LStream, FLeftFromLastTime);
      LStream.Position := 0;
      inherited Decode(LStream);
    finally
      FreeAndNil(LStream);
      SetLength(FLeftFromLastTime, 0);
    end;
  end;
  inherited DecodeEnd;
end;

procedure TIdDecoderMIMELineByLine.Decode(ASrcStream: TStream; const ABytes: Integer = -1);
var
  LMod, LDiv: integer;
  LIn, LSrc: TIdBytes;
  LStream: TMemoryStream;
begin
  LIn := FLeftFromLastTime;
  if ReadTIdBytesFromStream(ASrcStream, LSrc, ABytes) > 0 then begin
    AppendBytes(LIn, LSrc);
  end;
  LMod := Length(LIn) mod 4;
  if LMod <> 0 then begin
    LDiv := (Length(LIn) div 4) * 4;
     //I change to
    FLeftFromLastTime := Copy(LIn, LDiv, Length(LIn)-LDiv);  
    LIn := Copy(LIn, 0, LDiv);
   //old code
   //FLeftFromLastTime := Copy(LIn, LDiv+1, Length(LIn)-LDiv);
   //LIn := Copy(LIn, 1, LDiv);
  end else begin
    SetLength(FLeftFromLastTime, 0);
  end;
  LStream := TMemoryStream.Create;
  try
    WriteTIdBytesToStream(LStream, LIn);
    LStream.Position := 0;
    inherited Decode(LStream, ABytes);
  finally
    FreeAndNil(LStream);
  end;
end;
Steps to Reproduce:
None
Workarounds
None
Attachment
None
Comments

Tomohiro Takahashi at 6/14/2010 5:53:28 PM -
Could you please write more detailed Description and attach simple sample project to understand/reproduce your issue?

Server Response from: ETNACODE01