Примеры ошибок, обнаруженных с помощью диагностики V1032
V1032. Pointer is cast to a more strictly aligned pointer type.
Vib-OS
V1032 The pointer 'dst' is cast to a more strictly aligned pointer type. window.c 3108
/* Optimized memcpy for scanlines */
static inline void fast_memcpy_line(uint32_t *dst, uint32_t *src, int width) {
/* Use 64-bit copies for better performance */
uint64_t *d64 = (uint64_t *)dst;
uint64_t *s64 = (uint64_t *)src;
int count = width / 2;
for (int i = 0; i < count; i++) {
d64[i] = s64[i];
}
/* Handle odd pixel */
if (width & 1) {
dst[width - 1] = src[width - 1];
}
}
Similar errors can be found in some other places:
- V1032 The pointer 'src' is cast to a more strictly aligned pointer type. window.c 3109
qdEngine
V1032 [CWE-843, CERT-EXP36-C] The pointer 'buf' is cast to a more strictly aligned pointer type. zip_container.cpp 237
bool zipContainer::find_index()
{
const int buf_sz = 1024;
char buf[buf_sz];
stream_.seek(0,XS_END);
while(stream_.tell() >= buf_sz){
stream_.seek(-buf_sz,XS_CUR);
stream_.read(buf,buf_sz);
const unsigned long idx_signature = 0x06054b50L;
for(int i = 0; i < buf_sz - sizeof(long) * 3; i++){
if(*((unsigned long*)(buf + i)) == idx_signature){
XBuffer xbuf(buf + i + sizeof(long) + sizeof(unsigned short) * 4,
sizeof(long) * 2);
xbuf > index_size_ > index_offset_;
return true;
}
}
}
return false;
}
FreeCAD
V1032 [CWE-843, CERT-EXP36-C] The pointer 'auiResult' is cast to a more strictly aligned pointer type. Wm4TRational.inl 742
template <int N>
void TRational<N>::ConvertTo (double& rdValue) const
{
assert(m_kDenom != 0);
if (m_kNumer == 0)
{
rdValue = 0.0;
return;
}
unsigned int auiResult[2];
....
rdValue = *(double*)auiResult;
....
}