diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-29 15:43:37 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-29 15:43:37 +0000 |
commit | 8bca4f1387c255d1770ed5ab0e60700956b93bbe (patch) | |
tree | 5ba16e70e1d72729529fa0bfe721295c7fdff503 /libbacktrace | |
parent | 87447dd5c50934256cd801cfc9a2d3b5eda5bea8 (diff) | |
download | gcc-8bca4f1387c255d1770ed5ab0e60700956b93bbe.tar.gz |
* mmap.c (backtrace_vector_release): Make sure freed block is
aligned on 8-byte boundary.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192945 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libbacktrace')
-rw-r--r-- | libbacktrace/ChangeLog | 5 | ||||
-rw-r--r-- | libbacktrace/mmap.c | 14 |
2 files changed, 17 insertions, 2 deletions
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index 4850d9de37b..f04f1d5dd0d 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,8 @@ +2012-10-29 Ian Lance Taylor <iant@google.com> + + * mmap.c (backtrace_vector_release): Make sure freed block is + aligned on 8-byte boundary. + 2012-10-26 Ian Lance Taylor <iant@google.com> PR other/55087 diff --git a/libbacktrace/mmap.c b/libbacktrace/mmap.c index e07810d4575..25fdc21a9f7 100644 --- a/libbacktrace/mmap.c +++ b/libbacktrace/mmap.c @@ -229,8 +229,18 @@ backtrace_vector_release (struct backtrace_state *state, backtrace_error_callback error_callback, void *data) { - backtrace_free (state, (char *) vec->base + vec->size, vec->alc, - error_callback, data); + size_t size; + size_t alc; + size_t aligned; + + /* Make sure that the block that we free is aligned on an 8-byte + boundary. */ + size = vec->size; + alc = vec->alc; + aligned = (size + 7) & ~ (size_t) 7; + alc -= aligned - size; + + backtrace_free (state, (char *) vec->base + size, alc, error_callback, data); vec->alc = 0; return 1; } |