Sei sulla pagina 1di 9

:

: : 18.11.2010

. PVS-Studio. beta. . - Fennec Media Project. . (plugins) . . - qutIM. . , . Fennec Media Project. . 'b' , . 'a'. , . , 2010 . , 1.2 Alpha ,

int fennec_tag_item_compare(st ruct fennec_audiotag_item *a, struct fennec_audiotag_item *b) { int v; if(a->tsize && a->tsize) v = abs(str_cmp(a ->tdata, a->tdata)); else v = 1; return v; }

PVS-Studio

"a->tsize && a->tsize" :

V501 There are identical sub-expressions to the left and to the right of the '&&' operator: a -> tsize && a -> tsize media library.c 1076 :
int settings_default(void) { ... for(i=0; i<16; i++); for(j=0; j<32; j++) { settings.conversion.equalizer_bands.boost[i][j] = 0.0; settings.conversion.equalizer_bands.preamp[i] } } = 0.0;

PVS-Studio

V529 Odd semicolon ';' after 'for' operator. settings.c 483 :


int trans_rest(transcoder_settings *trans) { ... for(i=0; i<16; i++); { trans->eq.eq.preamp[i] for(j=0; j<32; j++) { trans->eq.eq.boost[i][j] = 0.0; } } } = 0.0;

PVS-Studio

V529 Odd semicolon ';' after 'for' operator. settings.c 913 ';'. . , CreateThread Fennec . , _beginthreadex :
cfunc)

CreateThread.

t_sys_thread_handle sys_thread_call(t_sys_thread_function { unsigned long tpr = 0; unsigned long tid = 0; return (t_sys_thread_handle) CreateThread(0, 0, cfunc, &tpr, 0,&tid); }

PVS-Studio

V513 Use _beginthreadex/_endthreadex functions instead of CreateThread/ExitThread functions. system.c 331 , CreateThread/ExitThread, . , : . _beginthreadex/_endthreadex ,

( MSDN)

A thread in an executable that calls the C run-time library (CRT) should use the _beginthreadex and _endthreadex functions for thread management rather than CreateThread andExitThread; this requires the use of the multi-threaded version of the CRT. If a thread created using CreateThread calls the CRT, the CRT may terminate the process in low-memory conditions. _beginthreadex/_endthreadex. "Windows 64-

: Windows" /

Win32. . - 4.

. , . .

, , , sizeof(), .

, ,

memset. , memset, memcmp, memcpy , STL . .

Fennec.
#define uinput_size

memset:
1024

typedef wchar_t letter;

letter

uinput _text[uinput_size];

string basewindows_getuserinput(const string title, const string cap, const string dtxt) { memset(uinput_text, 0, uinput_size); ... }

PVS-Studio

V512 A call of the 'memset' function will lead to a buffer overflow or underflow. base windows.c 151 "memset(uinput_text, 0, uinput_size);" , 'letter' 'char'. . memset:
typedef wchar_t letter; letter name[30];

. 'wchar_t'

int Conv_EqualizerProc(HWND hwnd,UINT uMsg, WPARAM wParam,LPARAM lParam) { ... memset(eqp.name, 0, 30); ... }

. :). PVS-Studio :

"sizeof(eqp.name)".

V512 A call of the 'memset' function will lead to a buffer overflow or underflow. base windows.c 2892 : V512 A call of the 'memset' function will lead to a buffer overflow or underflow. transcode settings.c 588

, , Windows API . ,

. ,

/ .

lpstrFilter , . . :

OPENFILENAME. ' 0'. \

int JoiningProc(HWND hwnd,UINT uMsg, WPARAM wParam,LPARAM lParam) { ... OPENFILENAME lofn;

memset(&lofn, 0, sizeof(lofn)); ... lofn.lpstrFilter = uni("All Files (*.*) \0*.*"); ... }

PVS-Studio

V540 Member 'lpstrFilter' should point to string terminated by two 0 characters. base windows.c 5309 , "All Files (*.*)\0*.*". , .
int callback_presets_dialog(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { ... // SAVE OPENFILENAME lofn; memset(&lofn, 0, sizeof(lofn)); ...

, "All Files (*.*)\0*.*\0". .

lofn.lpstrFilter = uni("Equalizer Preset (*.feq) \0*.feq"); ... ... // LOAD ... lofn.lpstrFilter = uni("Equalizer Preset (*.feq) \0*.feq"); ... } int localsf_show_save_playlist(void) { OPENFILENAME lofn;

memset(&lofn, 0, sizeof(lofn)); ... lofn.lpstrFilter = uni("Text file (*.txt) \0*.txt\0M3U file\0*.m3u"); ... }

PVS-Studio

V540 Member 'lpstrFilter' should point to string terminated by two 0 characters. base windows.c 986 V540 Member 'lpstrFilter' should point to string terminated by two 0 characters. base windows.c 1039 V540 Member 'lpstrFilter' should point to string terminated by two 0 characters. shared functions.c 360 . , : . ,

unsigned long ml_cache_getcurrent_item(void) { if(!mode_ml) return skin.shared ->audio.output.playlist.getcurrentindex(); else return skin.shared ->audio.output.playlist.getcurrentindex(); }

PVS-Studio

V523 The 'then' statement is equivalent to the 'else' statement. media library window.c 430 , . Fennec.

. Codec ACC.
void MP4RtpHintTrack::GetPayload( ...) { ... if (pSlash != NULL) { pSlash++; if (pSlash != '\0') {

length = strlen(pRtpMap) - (pSlash - pRtpMap); *ppEncodingParams = (char *)MP4Calloc(length + 1); strncpy(*ppEncodingParams, pSlash, length); } }

PVS-Studio: V528 It is odd that pointer to 'char' type is compared with the '\0' value. Probably meant: *pSlash != '\0'. rtphint.cpp 346 . , : "if (*pSlash != '\0')". Decoder Mpeg Audio:
void* tag_write_setframe(char *tmem, const char *tid, const string dstr) { ... if(lset) { fhead[11] = '\0'; fhead[12] = '\0'; fhead[13] = '\0';

0.

fhead[13] = '\0'; } ... }

PVS-Studio

V525 The code containing the collection of similar blocks. Check items '11', '12', '13', '13' in lines 716, 717, 718, 719. id3 editor.c 716 Copy-Paste :). Fennec Media Project . 31 . qutIM. PVS-Studio 200 ), . qutIM " ? 1) qutIM : . ( 2) PVS-Studio . . . A) B) . : , CreateThread. . save(), qutIM cancel(), , PVS-Studio qutIM? . , . . qutIM , , :). . ". . PVS-Studio qutIM , . , 19 PVS-Studio . PVS-Studio .

PVS-Studio).

void XSettingsWindow::save() { QWidget *c = p ->stackedWidget->currentWidget(); while (p->modifiedWidgets.count()) {

SettingsWidget *widget = p ->modifiedWidgets.takeFirst(); widget->save(); if (widget != c) widget->deleteLater(); } p->buttonBox->close(); }

void XSettingsWindow::cancel() { QWidget *c = p ->stackedWidget->currentWidget(); while (p->modifiedWidgets.count()) { SettingsWidget *widget = p ->modifiedWidgets.takeFirst(); widget->save(); if (widget != c) widget->deleteLater(); } p->buttonBox->close(); }

PVS-Studio: V524 It is odd that the 'cancel' function is fully equivalent to the 'save' function (xsettingswindow.cpp, line 256). xsettingswindow.cpp 268 , Studio , . , PVS-Studio 4.00 Beta. . , PVS-

Potrebbero piacerti anche