summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2015-03-13 23:45:20 +0100
committerRoland Scheidegger <sroland@vmware.com>2015-03-17 00:46:48 +0100
commit2372275d2fc9e4d3785b34a5aeb7b6126e8cc402 (patch)
tree2b6b957f5e31644074e664fe70a5cc8012bb33f0 /src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
parent9d1682d619426d0a5b90a12df82390cdfa098107 (diff)
downloadexternal_mesa3d-2372275d2fc9e4d3785b34a5aeb7b6126e8cc402.zip
external_mesa3d-2372275d2fc9e4d3785b34a5aeb7b6126e8cc402.tar.gz
external_mesa3d-2372275d2fc9e4d3785b34a5aeb7b6126e8cc402.tar.bz2
gallivm: abort properly when running out of buffer space in lp_disassembly
Before this actually ran into an infinite loop printing out "invalid"... Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_debug.cpp')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_debug.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
index 402d29e..2c4ed21 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
@@ -399,19 +399,23 @@ disassemble(const void* func, llvm::raw_ostream & Out)
break;
}
}
+
+ if (pc >= extent) {
+ Out << "disassembly larger than " << extent << "bytes, aborting\n";
+ break;
+ }
}
+ Out << "\n";
+ Out.flush();
+
/*
* Print GDB command, useful to verify output.
*/
-
if (0) {
_debug_printf("disassemble %p %p\n", bytes, bytes + pc);
}
- Out << "\n";
- Out.flush();
-
return pc;
}