Fix CID-8112 & -8113 (strange pointer arithmetic)

* BShape:: AddShape(): drop manual multiplication in typed pointer 
  arithmetic - addding the number of elements to a typed pointer
  will already move that pointer in steps of sizeof(type). 
The effect of this bug would be overwritten memory somewhere behind the data array.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39951 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2010-12-26 15:50:08 +00:00
parent 9201344705
commit 08f914dc67
+2 -2
View File
@@ -343,11 +343,11 @@ BShape::AddShape(const BShape* otherShape)
if (!AllocateOps(otherData->opCount) || !AllocatePts(otherData->ptCount))
return B_NO_MEMORY;
memcpy(data->opList + data->opCount * sizeof(uint32), otherData->opList,
memcpy(data->opList + data->opCount, otherData->opList,
otherData->opCount * sizeof(uint32));
data->opCount += otherData->opCount;
memcpy(data->ptList + data->ptCount * sizeof(BPoint), otherData->ptList,
memcpy(data->ptList + data->ptCount, otherData->ptList,
otherData->ptCount * sizeof(BPoint));
data->ptCount += otherData->ptCount;