Mesa (master): clover: fix tgsi compiler crash with invalid src

Francisco Jerez currojerez at kemper.freedesktop.org
Thu Nov 26 13:39:37 UTC 2015


Module: Mesa
Branch: master
Commit: b7c958b7b7c44e8f4c6dc0190e4c198722e020e5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7c958b7b7c44e8f4c6dc0190e4c198722e020e5

Author: Serge Martin <edb+mesa at sigluy.net>
Date:   Mon Oct 26 16:53:00 2015 +0100

clover: fix tgsi compiler crash with invalid src

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

---

 src/gallium/state_trackers/clover/tgsi/compiler.cpp |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/state_trackers/clover/tgsi/compiler.cpp b/src/gallium/state_trackers/clover/tgsi/compiler.cpp
index 54cb747..4d05666 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;
 




More information about the mesa-commit mailing list