Windows -
:
: 12.10.2011
. PVS-Studio.
, , , .
- , . ,
- .
,
, . , ,
Intel IPP Samples.
"Intel IPP Samples for Windows - " [1]
27 2011 . 9 . IPP Samples
, . .
Intel PVS-Studio, .
, 9
.
,
. PVS-Studio 4.37 ( 4.10). ,
, . ,
, PVS-Studio .
.
template<typename T, Ipp32s size>
void HadamardFwdFast(..., Ipp16s* pDst)
{
Ipp32s *pTemp;
...
for(j=0;j<4;j++) {
a[0] = pTemp[0*4] + pTemp[1*4];
a[1] = pTemp[0*4] - pTemp[1*4];
a[2] = pTemp[2*4] + pTemp[3*4];
a[3] = pTemp[2*4] - pTemp[3*4];
pTemp = pTemp++;
bool MoveOnNextFrame()
{
if (m_nFrames>0)
{
m_pFrame[m_curIndex] = 0;
m_curIndex = (++m_curIndex)%m_maxN;
m_nFrames--;
return true;
}
return false;
}
PVS-Studio:
V567 Undefined behavior. The 'm_curIndex' variable is modified while being used twice between
sequence points. vc1_enc umc_vc1_enc_planes.h 630
.
, , . ,
m_curIndex 2 . :
A = m_curIndex + 1;
B = A % m_maxN;
m_curIndex = B;
m_curIndex = A;
, ,
.
IPLFUN(void, iplMpyRCPack2D,
(IplImage* srcA, IplImage* srcB, IplImage* dst))
{
...
if( (srcA->depth == IPL_DEPTH_8U ) ||
(srcB->depth == IPL_DEPTH_8U ) ||
(srcB->depth == IPL_DEPTH_16U) ||
(srcB->depth == IPL_DEPTH_16U) ||
(srcA->depth == IPL_DEPTH_1U ) ||
(srcB->depth == IPL_DEPTH_1U ) )
...
}
PVS-Studio:
V501 There are identical sub-expressions '(srcB->depth == 16)' to the left and to the right of the '||'
operator. ipl iplmpy2d.c 457
, . : "(srcA>depth == IPL_DEPTH_16U)".
UMC::Status
VC1EncoderADV::SetMEParams_I_Field(UMC::MeParams* MEParams)
{
UMC::Status umcSts
UMC::UMC_OK;
memset(MEParams,0,sizeof(MEParams));
...
}
PVS-Studio:
V512 A call of the 'memset' function will lead to underflow of the buffer 'MEParams'. vc1_enc
umc_vc1_enc_adv.cpp 1767
, "sizeof(MEParams)" ,
. :
"sizeof(*MEParams)".
Copy-Paste
Status VC1VideoDecoder::ResizeBuffer()
{
...
if(m_pContext && m_pContext->m_seqLayerHeader &&
m_pContext->m_seqLayerHeader->heightMB &&
m_pContext->m_seqLayerHeader->heightMB)
...
}
PVS-Studio:
Ipp32f pa_nb_long[NUM_CHANNELS][2][MAX_PPT_LONG];
MP3Status mp3enc_psychoacousticInit(...)
{
...
for (ch = 0; ch < NUM_CHANNELS; ch++)
for (i = 0; i < MAX_PPT_LONG; i++) {
for (j = 0; j < 3; j++)
state->pa_nb_long[ch][j][i] = (Ipp32f)1.0e30;
}
...
}
PVS-Studio:
V557 Array overrun is possible. The value of 'j' index could reach 2. mp3_enc
mp3enc_psychoacoustic_fp.c 361
. 'j' 2.
0 1. ,
:
for (j = 0; j < 2; j++)
, , , .
typedef Ipp32f samplefbout[2][18][32];
samplefbout fbout_data[NUM_CHANNELS];
'samplefbout' . :
typedef Ipp32f samplefbout[2][18][32];
samplefbout fbout_data[NUM_CHANNELS];
}
PVS-Studio:
V557 Array overrun is possible. The value of 'j' index could reach 35. mp3_enc
mp3enc_quantization_12_fp.c 639
V557 Array overrun is possible. The value of 'j' index could reach 35. mp3_enc
mp3enc_quantization_12_fp.c 640
JERRCODE CJPEGDecoder::DecodeScanBaselineNI(void)
{
...
for(c = 0; c < m_scan_ncomps; c++)
{
block = m_block_buffer +
(DCTSIZE2*m_nblock*(j+(i*m_numxMCU)));
, , . IPP
Samples , , . ,
:
vm_file* vm_file_fopen(const vm_char* fname, const vm_char* mode)
{
...
mds[3] = FILE_ATTRIBUTE_NORMAL |
(islog == 0) ? 0 : FILE_FLAG_NO_BUFFERING;
...
}
PVS-Studio:
V502 Perhaps the '?:' operator works in a different way than it was expected. The '?:' operator has a
lower priority than the '|' operator. vm vm_file_win.c 393
, ,
. .
int ec_fb_GetSubbandNum(void* stat)
{
_fbECState* state = (_fbECState*)stat;
return (state->freq - state->freq);
}
PVS-Studio:
V501 There are identical sub-expressions to the left and to the right of the '-' operator: state->freq state->freq speech ec_fb.c 253
.
, 'return' .
AACStatus alsdecGetFrame(...)
{
...
if (state->msbFirst == 0) {
void rrGetNextBunch_Spiral(...)
{
int x,y;
...
if(x < 0)
if(x < 0)
goto _begine;
...
if(y < 0)
if(y < 0)
goto _begine;
...
}
PVS-Studio:
V571 Recurring check. The 'if (x < 0)' condition was already verified in line 1025. 3d-viewer
rrdemosupport.cpp 1026
V571 Recurring check. The 'if (y < 0)' condition was already verified in line 1028. 3d-viewer
rrdemosupport.cpp 1029
.
Status H264ENC_MAKE_NAME(H264CoreEncoder_UpdateRefPicMarking)
(void* state)
{
...
// set frame_num to zero for this picture, for correct
// FrameNumWrap
core_enc->m_pCurrentFrame->m_FrameNum = 0;
core_enc->m_pCurrentFrame->m_FrameNum = 0;
...
}
PVS-Studio:
V519 The 'core_enc->m_pCurrentFrame->m_FrameNum' variable is assigned values twice successively.
Perhaps this is a mistake. Check lines: 1804, 1805. h264_enc umc_h264_video_encoder_tmpl.cpp.h
1805
? ? .
.
. ,
,
. , -
.
1. . Intel IPP Samples for Windows - .
http://www.viva64.com/ru/a/0069/
2. . (sequence points).
http://www.viva64.com/go.php?url=665