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

[fuzz, binary] Assertion `StartColNo <= map.getSourceLine().size() && "Invalid range!"' failed. #22327

Closed
llvmbot opened this issue Dec 18, 2014 · 4 comments
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" crash-on-invalid

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 18, 2014

Bugzilla Link 21953
Version trunk
OS Linux
Blocks #23431
Attachments test case
Reporter LLVM Bugzilla Contributor
CC @Keno,@nico

Extended Description

Fuzzing discovered that the attached test case, which contains non-printable characters, when given as input to

clang -fno-crash-diagnostics -std=c++11 -xc++ -c -emit-llvm

causes this assertion failure:

clang-3.6: tools/clang/lib/Frontend/TextDiagnostic.cpp:972: void highlightRange(const clang::CharSourceRange&, unsigned int, clang::FileID, const {anonymous}::SourceColumnMap&, std::string&, const clang::SourceManager&, const clang::LangOptions&): Assertion `StartColNo <= map.getSourceLine().size() && "Invalid range!"' failed.

@Keno
Copy link
Member

Keno commented Feb 7, 2016

I spent some time looking at this bug today. The reason this is happening is because when computing the line to show for the diagnostic we truncate at the first '\0' we encounter. This seemed like an easy fix, but then I saw that that had already been done once in r154981, which was reverted due to #13046 . I'd recommend reading the discussion there, but the gist is that scratch buffers have a bunch of zeros that we don't want to print. I really don't know what the right solution here is. Ideally I think you'd want to do something about the scratch buffer case, since in normal source files you probably do want to print null characters in the diagnostics such that the use can notice something is fishy. On the other hand, to at least fix this test case, one thing one could do is to only ignore trailing null bytes. That would work for this case, but I'm not convinced that there isn't a case where you can run into trouble there as well.

@kcc
Copy link
Contributor

kcc commented Nov 26, 2021

mentioned in issue #23431

@kcc kcc mentioned this issue Mar 28, 2015
@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
@Endilll Endilll added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash-on-invalid and removed clang Clang issues not falling into any other category labels Jul 8, 2023
@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 8, 2023

@llvm/issue-subscribers-clang-frontend

@Endilll
Copy link
Contributor

Endilll commented Jul 8, 2023

Appears to be fixed in Clang 3.9. Doesn't reproduce on Compiler Explorer, only locally.

@Endilll Endilll closed this as completed Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" crash-on-invalid
Projects
None yet
Development

No branches or pull requests

4 participants