Skip to content
Snippets Groups Projects
Commit 08bc6209 authored by Bruce Merry's avatar Bruce Merry
Browse files

Fixes to enqueue_copy_buffer_rect

There are two bugs:
1. If src_pitches or dst_pitches is specified, there is an uninitialised
   variable.
2. If ConstBuffer is given a short array and content==0, the internal
   buffer is not zero-filled, causing garbage to be passed on.

The latter probably affects a lot of other functions, but hopefully in a
positive way.

Fixes #105.
parent cd042903
No related branches found
No related tags found
No related merge requests found
......@@ -1406,9 +1406,13 @@ def _enqueue_copy_buffer_rect(queue, src, dst, src_origin, dst_origin, region,
if src_pitches is None:
src_pitches = _ffi.NULL
src_pitches_l = 0
else:
src_pitches_l = len(src_pitches)
if dst_pitches is None:
dst_pitches = _ffi.NULL
dst_pitches_l = 0
else:
dst_pitches_l = len(dst_pitches)
src_origin_l = len(src_origin)
dst_origin_l = len(dst_origin)
region_l = len(region)
......
......@@ -386,10 +386,8 @@ public:
{
if (l < n) {
memcpy(m_intern_buf, buf, type_size<T>::value * l);
if (content) {
for (size_t i = l;i < n;i++) {
m_intern_buf[i] = content;
}
for (size_t i = l;i < n;i++) {
m_intern_buf[i] = content;
}
this->set(m_intern_buf);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment