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

sentry_logger_zoe_logger format seems wrong? #1136

Open
2 of 3 tasks
zsd4yr opened this issue Jan 30, 2025 · 2 comments
Open
2 of 3 tasks

sentry_logger_zoe_logger format seems wrong? #1136

zsd4yr opened this issue Jan 30, 2025 · 2 comments

Comments

@zsd4yr
Copy link
Contributor

zsd4yr commented Jan 30, 2025

Description

implies that it is recommended to use

char formatted[128];
vsprintf(formatted, message, args);

But I am seeing a case where a message of failed to read envelope item from "%S" and va_list of Àk�a�� result in failed to read envelope item from "ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ

Image Image Image

When does the problem happen

When trying to get eventId after minidump upload, see code snippet in #1135

  • During build
  • During run-time
  • When capturing a hard crash

Environment

  • OS: Windows 11, 64-bit
  • Compiler: MSVC 14.40.33807
  • CMake version and config: 3.29.3.0, SENTRY_BACKEND=NULL

Steps To Reproduce

  1. Redirect output with
static void
test_logger(
    sentry_level_t level, const char *message, va_list args, void *_data)
{
    logger_test_t *data = _data;
    if (data->assert_now) {
        data->called += 1;

        TEST_CHECK(level == SENTRY_LEVEL_WARNING);

        char formatted[128];
        vsprintf(formatted, message, args);

        TEST_CHECK_STRING_EQUAL(formatted, "Oh this is bad");
    }
}

sentry_options_set_debug(options, true);
sentry_options_set_logger(options, test_logger, &data);
  1. Try to upload a minidump
  2. Try to get the resulting event id
  3. issue is inconsistent, not 100% because the warning does not always occur. But -- when the warning occurs, the logging issue is 100%

Log output

"using database path '[REDACTED]\\.sentry-native'\u0000"
"failed to read envelope item from '����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@\u0004�A`\u0001'\u0000"
"Minidump has been captured: '����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@\u0004�A`\u0001'\u0000"

@zsd4yr
Copy link
Contributor Author

zsd4yr commented Jan 30, 2025

Looking at

SENTRY_WARNF("failed to read envelope item from \"%" SENTRY_PATH_PRI
"\"",
path->path);
, looks like this should be a const sentry_path_t *->path,
#ifdef SENTRY_PLATFORM_WINDOWS
typedef wchar_t sentry_pathchar_t;
# define SENTRY_PATH_PRI "S"
#else
typedef char sentry_pathchar_t;
# define SENTRY_PATH_PRI "s"
#endif
struct sentry_path_s {
sentry_pathchar_t *path;
};
which appears to be a sentry_pathchar_t * a pointier to a character, either S or s depending on platform

@supervacuus
Copy link
Collaborator

I am sorry. I'm unsure what you're trying to accomplish, what goes wrong, or what your setup looks like. Can you provide an isolated repro of the issue you want to highlight?

@kahest kahest moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Feb 6, 2025
@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 3 Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Community
Status: Needs More Information
Development

No branches or pull requests

3 participants