Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C Builder incorrectly decodes header under the release configuration for TIdMessage #399

Open
7even11 opened this issue Feb 10, 2022 · 0 comments
Labels
Element: Email Encoders/Decoders Issues related to Email parsers and generators Status: Review Needed Issue needs further review to decide next status Type: Bug Issue is a bug in existing code

Comments

@7even11
Copy link

7even11 commented Feb 10, 2022

Attached with this bug report is a project which demonstrates it:
IndyBug-CPP.zip

RAD studio used is 10.4.2 (Sydney)

Under the Debug configuration program builds and runs fine and properly decodes subject header (note - the same happens for other headers as well as filenames under the body):

Проба 123

Under the Release configuration, the output is garbled.

ðÒÏÂÁ 123

The only difference in release configuration are the usual to build standalone executable:

  • C Linker / Link with dynamic RTL - unchecked
  • Runtime packages / Link with runtime packages - unchecked.

The above is in KOI8-R (Russian) encoding but the problem doesn't only appear for that encoding, the same happens for windows-1255 (Hebrew) encoding as well and most likely other encodings.

Code:

TMemoryStream* ms = new TMemoryStream();
char buff[] = "Subject: =?KOI8-R?B?8NLPwsE=?= 123\r\n\r\ntest";
ms->Write(buff, sizeof(buff));
ms->Position = 0;

IdMsg->Clear();
// Suppress depreciated warning
#pragma warn -8111
Idmessagehelper::TIdMessageHelper_LoadFromStream(IdMsg, ms, false, false);
#pragma warn .8111

Memo1->Lines->Clear();
Memo1->Lines->Add(IdMsg->Subject);

delete ms;

So in other words, when exe is statically linked it doesn't work but it works from the debugger config.

Again, the problem occurs both on headers as well as body attachment filenames.

The problem has been present for a long time in Indy.

@7even11 7even11 changed the title C Builder incorrectly decodes header under the release configuration C Builder incorrectly decodes header under the release configuration for TIdMessage Feb 10, 2022
@rlebeau rlebeau added Element: Email Encoders/Decoders Issues related to Email parsers and generators Type: Bug Issue is a bug in existing code Status: Review Needed Issue needs further review to decide next status labels Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Element: Email Encoders/Decoders Issues related to Email parsers and generators Status: Review Needed Issue needs further review to decide next status Type: Bug Issue is a bug in existing code
Projects
None yet
Development

No branches or pull requests

2 participants