Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2018-04-21 15:53:40 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2018-04-21 15:53:40 +0300
commit764792d8db77b84ecbd981d71e8c5fa1d808d801 (patch)
treebea28d84f7b3327161850874f1489066fa9474e7 /server/TracyFileHeader.hpp
parenta63f21496426f808c0f629f41c0b260499f3c4b6 (diff)
Try to not crash when opening invalid files.
Tracy will now perform a number of checks when trying to read a dump file: 1. The file must have at least 4 bytes of data. 2. There should be a 4 byte header to indicate the file was saved by tracy. This is a breaking change in file format. 3. Old header-less files are still supported, but there's a new check for data validity. The first 4 bytes of file (as an uint32) must be less or equal to max LZ4 data packet size. This requires the first two bytes to be 00 00 or 00 01, which should catch most invalid files.
Diffstat (limited to 'server/TracyFileHeader.hpp')
-rw-r--r--server/TracyFileHeader.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/TracyFileHeader.hpp b/server/TracyFileHeader.hpp
new file mode 100644
index 00000000..67ca8afc
--- /dev/null
+++ b/server/TracyFileHeader.hpp
@@ -0,0 +1,11 @@
+#ifndef __TRACYFILEHEADER_HPP__
+#define __TRACYFILEHEADER_HPP__
+
+namespace tracy
+{
+
+static const char Lz4Header[4] = { 't', 'l', 'Z', 4 };
+
+}
+
+#endif