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

IL parser should detect non-constant strings (ldstr) passed to Get*String calls #16

Open
abock opened this issue Jul 17, 2012 · 1 comment

Comments

@abock
Copy link
Contributor

abock commented Jul 17, 2012

The IL parser can extract false-positives if the Catalog.Get*String APIs are misused. To avoid this, and to warn of improper usage of the API, the IL parser should warn if non-constants are passed to the APIs.

Example:

void Foo()
{
    var x = "Foo";
    DoSomething("Hello");
    Catalog.GetString(x);
}

Vernacular may actually extract the constant ldstr "Hello" instruction that is an argument for DoSomething because x (a non-constant load) is passed to GetString.

Fixing this addresses two issues:

  • no false-positive string extractions due to possible "bleeding" of ldstr instructions
  • catch improper usage of the API where non-constants are being passed (and thus not possible to extract)
@StephaneDelcroix
Copy link
Contributor

I totally second this, but it would require an additional API call to do Catalog.GetString(x) on purpose, used only at runtime and not parsed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants