From: Serge Martin Date: Mon, 26 Oct 2015 15:53:00 +0000 (+0100) Subject: clover: fix tgsi compiler crash with invalid src X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b7c958b7b7c44e8f4c6dc0190e4c198722e020e5;p=mesa.git clover: fix tgsi compiler crash with invalid src Reviewed-by: Francisco Jerez --- diff --git a/src/gallium/state_trackers/clover/tgsi/compiler.cpp b/src/gallium/state_trackers/clover/tgsi/compiler.cpp index 54cb747e6fb..4d056668a22 100644 --- a/src/gallium/state_trackers/clover/tgsi/compiler.cpp +++ b/src/gallium/state_trackers/clover/tgsi/compiler.cpp @@ -97,6 +97,11 @@ namespace { module clover::compile_program_tgsi(const std::string &source, std::string &r_log) { const size_t body_pos = source.find("COMP\n"); + if (body_pos == std::string::npos) { + r_log = "invalid source"; + throw compile_error(); + } + const char *body = &source[body_pos]; module m;