Revision: 7d3f6da69e81
Author: Behdad Esfahbod <
beh...@behdad.org>
Date: Wed Jun 18 22:05:21 2014 UTC
Log: Fix possible memory bug
In case the vector implementation shrinks the underlying
array.
http://code.google.com/p/glyphy/source/detail?r=7d3f6da69e81
Modified:
/src/glyphy-blob.cc
=======================================
--- /src/glyphy-blob.cc Tue Jun 3 18:25:14 2014 UTC
+++ /src/glyphy-blob.cc Wed Jun 18 22:05:21 2014 UTC
@@ -296,8 +296,10 @@
haystack_len--;
}
if (found) {
+ unsigned int new_offset = haystack - &tex_data[0];
tex_data.resize (offset);
- offset = haystack - &tex_data[0];
+ haystack = needle = NULL; /* Invalidated by the resize. */
+ offset = new_offset;
}
}
else