[glyphy] push by behdad@google.com - Fix possible memory bug... on 2014-06-18 22:05 GMT

13 views
Skip to first unread message

gly...@googlecode.com

unread,
Jun 18, 2014, 6:05:53 PM6/18/14
to gly...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages