[PATCH] D51867: [Diagnostics] Add error handling to FormatDiagnostic()

2018-09-21 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment. It seems like there are too many asserts and they are too specific, they seem to be aimed at specific potential bugs. What about asserts that make sure we maintain some invariants? For example, check `DiagStr < DiagEnd` once in a loop instead of every place we

[PATCH] D51867: [Diagnostics] Add error handling to FormatDiagnostic()

2018-09-17 Thread Jan Korous via Phabricator via cfe-commits
jkorous added a comment. Hi Volodymyr, do you think you might take another look? Repository: rC Clang https://reviews.llvm.org/D51867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D51867: [Diagnostics] Add error handling to FormatDiagnostic()

2018-09-10 Thread Jan Korous via Phabricator via cfe-commits
jkorous added a comment. I tried to come up with some input that breaks current implementation so I could add the test. Problem is that invalid memory read doesn't guarantee deterministic crash. E. g. with this input the current implementation is definitely reading way past the buffer:

[PATCH] D51867: [Diagnostics] Add error handling to FormatDiagnostic()

2018-09-10 Thread Jan Korous via Phabricator via cfe-commits
jkorous planned changes to this revision. jkorous added a comment. Hi Volodymyr, Thanks for the feedback - interesting points! I see your point regarding NFC - I am going to drop it as you are right. Two things about sanitizers come to mind: 1. You'd need to guarantee that you have all