Message ID | 1349738279-13253-2-git-send-email-j.neuschaefer@gmx.net (mailing list archive) |
---|---|
State | Rejected, archived |
Headers | show |
On Tue, Oct 9, 2012 at 2:17 AM, Jonathan Neuschäfer <j.neuschaefer@gmx.net> wrote: > If sparse emits an error message while parsing a file, don't > generate LLVM code, and also don't parse further files. This > prevents a segfault when sparse-llvm is fed with certain junk. > > Cc: Pekka Enberg <penberg@kernel.org> > Cc: Christopher Li <sparse@chrisli.org> > Cc: Jeff Garzik <jgarzik@redhat.com> > Cc: Linus Torvalds <torvalds@linux-foundation.org> > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Acked-by: Pekka Enberg <penberg@kernel.org> Chris, this depends on the first patch so please just take this directly to your tree. -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/sparse-llvm.c b/sparse-llvm.c index e4929e9..0fc0dae 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -1268,7 +1268,10 @@ int main(int argc, char **argv) compile(module, sparse_initialize(argc, argv, &filelist)); FOR_EACH_PTR_NOTAG(filelist, file) { - compile(module, sparse(file)); + struct symbol_list *symlist = sparse(file); + if (error_happened) + break; + compile(module, symlist); } END_FOR_EACH_PTR_NOTAG(file); LLVMVerifyModule(module, LLVMPrintMessageAction, NULL);
If sparse emits an error message while parsing a file, don't generate LLVM code, and also don't parse further files. This prevents a segfault when sparse-llvm is fed with certain junk. Cc: Pekka Enberg <penberg@kernel.org> Cc: Christopher Li <sparse@chrisli.org> Cc: Jeff Garzik <jgarzik@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> --- sparse-llvm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)