Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dynamorio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,467
    • Issues 1,467
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynamoRIO
  • dynamorio
  • Issues
  • #5181
Closed
Open
Issue created Oct 30, 2021 by Administrator@rootContributor

<APP CRASH> - Notepad++ Crashes with droption_t

Created by: grubeli

Describe the bug I want to parse arguments send to client dll by a front-end (similar to drrun.exe) via dr_register_client . To do this I'm using droption_parser_t on client side to parse arguments, it works on simple hello worlds apps but have issues with real works apps, for example, notepad++ (64bit) crashes instantly, even if there is no other code than droption_parser_t::parse_argv.

To Reproduce Steps to reproduce the behavior:

  1. compile a client dll with following code:
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
  droption_t<std::string> first_arg(DROPTION_SCOPE_CLIENT, "aaa", "", "aaaaaa",
                                         "aaaaaaaaaaaaaa");
  droption_t<unsigned int> second_arg(DROPTION_SCOPE_CLIENT, "bbb", 0, "bbbbbb",
                                             "bbbbbbbbbbbbbbb");
  std::string parse_err;
  int last_index;
  if (!droption_parser_t::parse_argv(DROPTION_SCOPE_CLIENT, argc, argv, &parse_err, &last_index))
  {
    dr_fprintf(STDERR, "Usage error: %s", parse_err.c_str());
    dr_messagebox("argument parsing error");
    dr_abort();
  }
}

My custom front-end have following code to provide arguments to the client:

client_id_t client_id = 0;
const auto client_options = "--aaa " + first_string.string() + " " +
			                    "--bbb " + std::to_string(second_arg.get_value());
if (dr_register_client(process_name, pid, false /*local*/, DR_PLATFORM_DEFAULT, client_id, 0,
client_path.string().c_str(), client_options.c_str()) != DR_SUCCESS)
{
logger.logger->critical("dr_register_client function call failed");
exit(1);
}

If I run my client dll without droption_t and just hardcode the two values it works as excepted, no crashes. My guess is that there is an issue how args are provided or how they are parsed

  1. {..}/my_front.exe -c ./yourclient.dll -- 'C:\Program Files\Notepad++\notepad++.exe'
  2. The notepad++ will not even open

Please also answer these questions:

  • What happens when you run without any client?
    • {..}/drrun.exe -- 'C:\Program Files\Notepad++\notepad++.exe' - Notepad++ runs as expected.
  • What happens when you run with debug build ("-debug" flag to drrun/drconfig/drinject)?
    • Getting messagebox with text: "argument parsing error", since we parsing arguments and drrun doesn't provide any.

Expected behavior Open Notepad++

Versions

  • What version of DynamoRIO are you using?
    • DynamoRIO-Windows-8.0.18921
  • Does the latest build from https://github.com/DynamoRIO/dynamorio/releases solve the problem?
    • No
  • What operating system version are you running on? ("Windows 10" is not sufficient: give the release number.)
    • Windows 10, Version 20H2 - Build 19042.1288
  • Is your application 32-bit or 64-bit?
    • 64
Assignee
Assign to
Time tracking