å°ãåã«ãFirebird DBMSã®æ°ããããŒãžã§ã³ããªãªãŒã¹ãããŸããã ãã®ãªãªãŒã¹ã¯ããããžã§ã¯ãã®æŽå²äžæ倧ã®ãã®ã®1ã€ã«ãªããŸãããã¢ãŒããã¯ãã£ãå€§å¹ ã«åèšèšããããã«ãã¹ã¬ããã®ãµããŒããè¿œå ãããçç£æ§ãåäžããŸããã ãã®ãããªéèŠãªæŽæ°ããPVS-Studioéçã³ãŒãã¢ãã©ã€ã¶ãŒã䜿çšããŠFirebirdãåãã§ãã¯ããçç±ã§ããã
ã¯ããã«
Firebirdã¯ãã¯ãã¹ãã©ãããã©ãŒã ã®ç¡æã®ããŒã¿ããŒã¹ç®¡çã·ã¹ãã ã§ãã ãã®ãããžã§ã¯ãã¯C ++ã§èšè¿°ãããŠãããMicrosoft WindowsãLinuxãMac OS Xãããã³å€ãã®Unixã©ã€ã¯ãªãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã§å®è¡ãããŸãã DBMSã¯å®å šã«ç¡æã§äœ¿çšããã³é åžã§ããŸãã Firebirdã®è©³çŽ°ã«ã€ããŠã¯ã å ¬åŒWebãµã€ããã芧ãã ããã
Firebirdã¯ã以åã«ã¢ãã©ã€ã¶ãŒã«ãã£ãŠãã¹ããããŠããŸããã åã®ãã§ãã¯ã«é¢ããã¬ããŒãã¯ãèšäºã æ ä¿çµæïŒPVS-Studioã䜿çšããŠFirebirdããã§ãã¯ãã ãã§èŠã€ããããšãã§ããŸãã æ€èšŒã®ããããã¹ã¿ãŒãã©ã³ãã®GitHubããã³ãŒããååŸããŸããã ã¢ã»ã³ããªã®è©³çŽ°ã«ã€ããŠã¯ããããžã§ã¯ãWebãµã€ãã®å¯Ÿå¿ããèšäºãåç §ããŠãã ããã ãœãŒã¹ãã¡ã€ã«ã®åæã¯ãã³ã³ãã€ã©ã¢ãã¿ãªã³ã°ïŒã³ã³ãã€ã©ã¢ãã¿ãªã³ã°ïŒã®ã€ã³ã¿ãŒã»ããã䜿çšããŠã PVS-Studioã¹ã¿ã³ãã¢ãã³ããŒãžã§ã³6.03ã§å®è¡ãããŸããã ãã®ãã¯ãããžãŒã«ãããã¢ã»ã³ããªã·ã¹ãã ã«çµ±åããã«ãããžã§ã¯ããæ€èšŒã§ããŸãã åä¿¡ããã¬ããŒãã¯ãã¹ã¿ã³ãã¢ãã³ããŒãžã§ã³ãšVisual Studioã®äž¡æ¹ã§è¡šç€ºã§ããŸãã
ã¿ã€ããã¹
void advance_to_start() { .... if (!isalpha(c) && c != '_' && c != '.' && c != '_') syntax_error(lineno, line, cptr); .... }
PVS-StudioèŠåïŒ V501åäžã®ãµãåŒããããŸã 'cïŒ=' _ '' '&&'æŒç®åã®å·Šå³ã«ã reader.c 1203
ã¢ãã©ã€ã¶ãŒã¯ãè«çæäœã«2ã€ã®åäžã®éšååŒcïŒ= '_'ãååšããããšãæ€åºããŸããã æåŸã®æ¡ä»¶ã§ã¯ãã¿ã€ããã¹ãèš±å¯ãããŠãããå€æ°cã¯å¥ã®æåãšæ¯èŒããå¿ èŠããããŸãã ä»ã®é¢æ°ã¯ '$'èšå·ã®ä»ãããã§ãã¯ã䜿çšããŸããããããããã§äœ¿çšããå¿ èŠããããŸãã
if (!isalpha(c) && c != '_' && c != '.' && c != '$')
äžæ³šæãªãšã©ãŒã®å¥ã®äŸïŒ
int put_message(....) { if (newlen <= MAX_UCHAR) { put(tdgbl, attribute); put(tdgbl, (UCHAR) newlen); } else if (newlen <= MAX_USHORT) { if (!attribute2) BURP_error(314, ""); .... } else BURP_error(315, ""); .... }
PVS-Studioã®èŠåïŒ
- V601æååãªãã©ã«ã¯æé»çã«ããŒã«åã«ãã£ã¹ããããŸãã 2çªç®ã®åŒæ°ã調ã¹ãŸãã backup.cpp 6113
- V601æååãªãã©ã«ã¯æé»çã«ããŒã«åã«ãã£ã¹ããããŸãã 2çªç®ã®åŒæ°ã調ã¹ãŸãã backup.cpp 6120
ããã§ã¯ãBURP_erroré¢æ°ã誀ã£ãŠäœ¿çšãããŠããŸãã 次ã®ããã«å®£èšãããŸãã
void BURP_error(USHORT errcode, bool abort, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg()); void BURP_error(USHORT errcode, bool abort, const char* str);
2çªç®ã®åŒæ°ã¯ããŒã«å€ã§ãæååã¯3çªç®ã®åŒæ°ã§ãã ãã®çµæãæååãªãã©ã«ã¯trueã«ãã£ã¹ããããŸãã é¢æ°åŒã³åºãã¯ãBURP_errorïŒ315ãtrueã ""ïŒãŸãã¯BURP_errorïŒ315ãfalseã ""ïŒã«æžãæããå¿ èŠããããŸãã
ãã ãããããžã§ã¯ãéçºè ã®ã¿ããšã©ãŒãèªèã§ããå ŽåããããŸãã
void IDX_create_index(....) { .... index_fast_load ifl_data; .... if (!ifl_data.ifl_duplicates) scb->sort(tdbb); if (!ifl_data.ifl_duplicates) BTR_create(tdbb, creation, selectivity); .... }
PVS-StudioèŠåïŒ V581äºãã«äžŠãã§ãããifãæŒç®åã®æ¡ä»¶åŒã¯åäžã§ãã è¡ã確èªããŠãã ããïŒ506ã509ãidx.cpp 509
åãæ¡ä»¶ã®2ã€ã®ãããã¯ãã³ãŒãã®è¡ã«ç¶ããŸãã ãã®ãã¡ã®1ã€ãã¿ã€ããã¹ãããã®ãããããŸãããããã®ç¶æ³ã¯åã ã®ã»ã¯ã·ã§ã³ã®ã³ããŒãŸãã¯åé€ãåå ã§çºçããå¯èœæ§ããããŸãããããã«ããŠãããã®ãããªã³ãŒãã¯å¥åŠã«èŠããŸãã
次ã®äŸã§ã¯ããã€ã³ã¿ãŒã®ããç¶æ³ãèããŸãã
static void string_to_datetime(....) { .... const char* p = NULL; const USHORT length = CVT_make_string(desc, ttype_ascii, &p, &buffer, sizeof(buffer), err); const char* const end = p + length; .... while (p < end) { if (*p != ' ' && *p != '\t' && p != 0) { CVT_conversion_error(desc, err); return; } ++p; } .... }
PVS-StudioèŠåïŒ V713ãã€ã³ã¿ãŒpã¯ãåãè«çåŒã®nullptrã«å¯ŸããŠæ€èšŒãããåã«ãè«çåŒã§äœ¿çšãããŸããã cvt.cpp 702
æ¡ä»¶ã§ã¯ãåç §è§£é€çŽåŸã«å€æ°pã® nullptr ããã§ãã¯ãããŸãã ããã¯ãæ€æ»å Žæã«å¥ã®æ¡ä»¶ããã£ãã¯ãã§ããããæ€èšŒãäžèŠã§ãã£ãããšãæå³ããå ŽåããããŸãã
ã³ãŒãã®äžãèŠããšãåæ§ã®ãã©ã°ã¡ã³ããèŠã€ããããšãã§ããŸãã
while (++p < end) { if (*p != ' ' && *p != '\t' && *p != 0) CVT_conversion_error(desc, err); }
ãã®ãããªãšã©ãŒãåé¿ããããã«ããŒããšã®æ¯èŒã«ã¯ã察å¿ãããªãã©ã«ã䜿çšããããšããå§ãããŸããã¿ã€ãcharã«ã¯ã\ 0ã ãæ°å€ã«ã¯0ããã€ã³ã¿ãŒã«ã¯nullptrã§ãã ãããã«ãŒã«ãšããŠæ¡çšããã°ããã®ãããªæããªééãã®å€ããé¿ããããšãã§ããŸãã
memcmpã®å±éºãªäœ¿çš
SSHORT TextType::compare(ULONG len1, const UCHAR* str1, ULONG len2, const UCHAR* str2) { .... SSHORT cmp = memcmp(str1, str2, MIN(len1, len2)); if (cmp == 0) cmp = (len1 < len2 ? -1 : (len1 > len2 ? 1 : 0)); return cmp; }
PVS-StudioèŠåïŒ V642 ãmemcmpãé¢æ°ã®çµæããshortãåå€æ°å ã«ä¿åããããšã¯äžé©åã§ãã ããã°ã©ã ã®ããžãã¯ãå£ããŠãéèŠãªãããã倱ãããå¯èœæ§ããããŸãã texttype.cpp 3
memcmpé¢æ°ã¯æ¬¡ã®å€ãè¿ããŸãã
- str1ã str2ããå°ããå Žå㯠<0
- str1ãstr2ãšçããå Žåã¯0
- > 0ïŒ str1ã str2ãã倧ããå ŽåïŒ
æååã®äžçåŒãæã€é¢æ°ã®æ£ç¢ºãªå€ã¯ä¿èšŒãããŸããããããã£ãŠã intããå°ããå€æ°ã«çµæãä¿åãããšãéèŠãªãããã倱ãããã¢ããªã±ãŒã·ã§ã³ããžãã¯ã«éåããå¯èœæ§ããããŸãã
è¿œå ã®ãã§ãã¯
void Trigger::compile(thread_db* tdbb) { SET_TDBB(tdbb); Database* dbb = tdbb->getDatabase(); Jrd::Attachment* const att = tdbb->getAttachment(); if (extTrigger) return; if (!statement /*&& !compile_in_progress*/) { if (statement) return; .... } }
èŠåPVS-StudioïŒ V637 2ã€ã®æ£å察ã®æ¡ä»¶ãçºçããŸããã 2çªç®ã®æ¡ä»¶ã¯åžžã«falseã§ãã è¡ã確èªïŒ778ã780ãjrd.cpp 778
ã¢ãã©ã€ã¶ãŒã¯ã2ã€ã®å察ã®æ¡ä»¶ã®ãã§ãã¯ãèŠã€ããŸããã ã»ãšãã©ã®å Žåãæåã®æ¡ä»¶ãå€æŽããçµæã2çªç®ã®æ¡ä»¶ã¯äžèŠã«ãªããåé€ã§ããŸãããäœæè ã¯ããã§æ±ºå®ããå¿ èŠããããŸãã
次ã®ã³ãŒãã¹ããããã¯ãå¥åŠãªãã©ã³ãã®å¥ã®äŸã§ãã
static void asgn_from( ref* reference, int column) { TEXT variable[MAX_REF_SIZE]; TEXT temp[MAX_REF_SIZE]; for (; reference; reference = reference->ref_next) { const gpre_fld* field = reference->ref_field; .... if (!field || field->fld_dtype == dtype_text) .... else if (!field || field->fld_dtype == dtype_cstring) .... else .... } }
èŠåPVS-StudioïŒ V560æ¡ä»¶åŒã®äžéšã¯åžžã«false ïŒïŒãã£ãŒã«ãã§ãã int_cxx.cpp 217
ãã£ãŒã«ãã NULLãã€ã³ã¿ãŒã§ãªãå Žåãã³ãŒãã¯else ifã®æ¡ä»¶ã«å°éããŸããã ãã®ãã§ãã¯ã¯äžèŠã§ããããå¥ã®æ¯èŒã代ããã«è¡ãããŠããã¯ãã§ãã ãã®æ¡ä»¶ãã¢ããªã±ãŒã·ã§ã³ããžãã¯ãšççŸãããã©ããã¯äžæã§ãã
ããã«ãè«çåŒã®ããã€ãã®äžèŠãªãã§ãã¯ãèŠã€ãããŸããã
bool XnetServerEndPoint::server_init(USHORT flag) { .... xnet_connect_mutex = CreateMutex(ISC_get_security_desc(), FALSE, name_buffer); if (!xnet_connect_mutex || (xnet_connect_mutex && ERRNO == ERROR_ALREADY_EXISTS)) { system_error::raise(ERR_STR("CreateMutex")); } .... }
PVS-StudioèŠåïŒ V728éå°ãªãã§ãã¯ãç°¡çŽ åã§ããŸãã ã||ã æŒç®åã¯ãå察ã®åŒãïŒxnet_connect_mutexããšãxnet_connect_mutexãã«å²ãŸããŠããŸãã xnet.cpp 2231
ifïŒïŒXnet_connect_mutex ||ïŒxnet_connect_mutex && ERRNO == ERROR_ALREADY_EXISTSïŒïŒãã§ãã¯ã¯ã ifïŒïŒXnet_connect_mutex || ERRNO == ERROR_ALREADY_EXISTSïŒã«ç°¡ç¥åã§ããŸãã ããã¯ãççå€è¡šã䜿çšããŠç°¡åã«èšŒæã§ããŸãã
笊å·ãªãå€æ°ã®å±éºãªæ¯èŒ
static bool write_page(thread_db* tdbb, BufferDesc* bdb, ....) { .... if (bdb->bdb_page.getPageNum() >= 0) .... }
PVS-Studioã®èŠå ïŒ V547åŒ 'bdb-> bdb_page.getPageNumïŒïŒ> = 0'ã¯åžžã«trueã§ãã 笊å·ãªãã®åã®å€ã¯åžžã«> = 0ã§ããcch.cpp 4827
æ¡ä»¶bdb-> bdb_page.getPageNumïŒïŒ> = 0ã¯ãé¢æ°ã笊å·ãªãã®åã®å€ãè¿ããããåžžã«çã«ãªããŸãã ããã°ã©ããŒãå€ã誀ã£ãŠãã§ãã¯ããå¯èœæ§ããããŸãã ãããžã§ã¯ãã§ã®åæ§ã®æ¯èŒãèæ ®ãããšãã³ãŒãã¯æ¬¡ã®ããã«ãªããŸãã
if (bdb->bdb_page.getPageNum() != 0)
NULLãã€ã³ã¿ãŒã®éåç §
static bool initializeFastMutex(FAST_MUTEX* lpMutex, LPSECURITY_ATTRIBUTES lpAttributes, BOOL bInitialState, LPCSTR lpName) { if (pid == 0) pid = GetCurrentProcessId(); LPCSTR name = lpName; if (strlen(lpName) + strlen(FAST_MUTEX_EVT_NAME) - 2 >= MAXPATHLEN) { SetLastError(ERROR_FILENAME_EXCED_RANGE); return false; } setupMutex(lpMutex); char sz[MAXPATHLEN]; if (lpName) .... }
PVS-StudioèŠåïŒ V595 nullptrã«å¯ŸããŠæ€èšŒãããåã«ããlpNameããã€ã³ã¿ãŒã䜿çšãããŸããã è¡ã確èªããŠãã ããïŒ2814ã2824ãisc_sync.cpp 2814
èŠåV595ã¯PVS-Studioã«ãã£ãŠæ€èšŒããããããžã§ã¯ãã§æãäžè¬çã§ãããFirebirdãäŸå€ã§ã¯ãããŸããã§ããã åèšã§ããã®èŠåã§30以äžã®å ŽæãèŠã€ãããŸããã
ãã®äŸã§ã¯ã nullptr pointerããã§ãã¯ããåã«strlenïŒlpNameïŒåŒã³åºããè¡ãããŸã ã ããã«ãããnullãã€ã³ã¿ãŒãé¢æ°ã«æž¡ãããšãããšãã«æªå®çŸ©ã®åäœãçºçããŸãã ãã€ã³ã¿ãŒã®éåç §ã¯strlenåŒã³åºãã§ããã«é ãããŠãããããéçã¢ãã©ã€ã¶ãŒã䜿çšããªããšãšã©ãŒãæ€åºããã®ãé£ãããªããŸãã
æ°ããåŸã«nullptrã確èªãã
rem_port* XnetServerEndPoint::get_server_port(....) { .... XCC xcc = FB_NEW struct xcc(this); try { .... } catch (const Exception&) { if (port) cleanup_port(port); else if (xcc) cleanup_comm(xcc); throw; } return port; }
PVS-StudioèŠåïŒ V668ã¡ã¢ãªã¯ãnewãæŒç®åã䜿çšããŠå²ãåœãŠãããããããxccããã€ã³ã¿ãŒãnullã«å¯ŸããŠãã¹ãããæå³ã¯ãããŸããã ã¡ã¢ãªå²ãåœãŠãšã©ãŒã®å ŽåãäŸå€ãçæãããŸãã xnet.cpp 2533
ã¢ãã©ã€ã¶ãŒã¯ãnewæŒç®åãnullptrãè¿ãããšãã§ããªãããšãèŠåããŸãããã§ãã¯ããã«ã¯ãtry-catchãããã¯ãŸãã¯newïŒstd :: nothrowïŒã䜿çšããå¿ èŠããããŸãã ãã ãããã®äŸã§ã¯ããã¹ãŠãããè€éã§ãã ã¡ã¢ãªãå²ãåœãŠãã«ã¯ããã¯ãFB_NEWã䜿çšãããŸãã alloc.hãã¡ã€ã«ã§å®£èšãããŠããŸãã
#ifdef USE_SYSTEM_NEW #define OOM_EXCEPTION std::bad_alloc #else #define OOM_EXCEPTION Firebird::BadAlloc #endif #define FB_NEW new(__FILE__, __LINE__) inline void* operator new(size_t s ALLOC_PARAMS) throw (OOM_EXCEPTION) { return MemoryPool::globalAlloc(s ALLOC_PASS_ARGS); }
éæšæºã®ã¢ãã±ãŒã¿ãŒã䜿çšãããŠããããããã®ç¹å®ã®äŸãééãã§ãããã©ãããå€æããããšã¯å°é£ã§ãã ãã ãã ã¹ããŒïŒstd :: bad_allocïŒãæŒç®åå®çŸ©ã§æå®ãããŠããããããã®ãããªãã§ãã¯ã¯çãããããã«èŠããŸãã
reallocã®å±éºãªäœ¿çš
int mputchar(struct mstring *s, int ch) { if (!s || !s->base) return ch; if (s->ptr == s->end) { int len = s->end - s->base; if ((s->base = realloc(s->base, len+len+TAIL))) { s->ptr = s->base + len; s->end = s->base + len+len+TAIL; } else { s->ptr = s->end = 0; return ch; } } *s->ptr++ = ch; return ch; }
PVS-Studio èŠå ïŒ V701 reallocïŒïŒãªãŒã¯ã®å¯èœæ§ïŒreallocïŒïŒãã¡ã¢ãªã®å²ãåœãŠã«å€±æãããšãå ã®ãã€ã³ã¿ãŒ 's-> base'ã倱ãããŸãã reallocïŒïŒãäžæãã€ã³ã¿ãŒã«å²ãåœãŠãããšãæ€èšããŠãã ããã mstring.c 42
ptr = reallocïŒptrãsizeïŒã®åœ¢åŒã®åŒã¯ã reallocãnullptrãè¿ããšãã«ã¡ã¢ãªãã€ã³ã¿ãŒã倱ããããšããç¹ã§äžé©åã§ãã ãããåé¿ããã«ã¯ã reallocã®çµæãäžæå€æ°ã«ä¿åããnullptrã確èªããåŸã ptrã«å€ãå²ãåœãŠãŸãã
temp_ptr = realloc(ptr, new_size); if (temp_ptr == nullptr) { //handle exception } else { ptr = temp_ptr; }
ã¹ã€ããã§æªäœ¿çšã®åæå€
template <typename CharType> LikeEvaluator<CharType>::LikeEvaluator(....) { .... PatternItem *item = patternItems.begin(); .... switch (item->type) { case piSkipFixed: case piSkipMore: patternItems.grow(patternItems.getCount() + 1); item = patternItems.end() - 1; // Note: fall into case piNone: item->type = piEscapedString; item->str.data = const_cast<CharType*> (pattern_str + pattern_pos - 2); item->str.length = 1; break; case piSearch: item->type = piEscapedString; // Note: fall into case piEscapedString: item->str.length++; break; } .... }
èŠåPVS-StudioïŒ V719 switchã¹ããŒãã¡ã³ãã¯ã 'PatternItemType'åæåã®ãã¹ãŠã®å€ãã«ããŒããããã§ã¯ãããŸããïŒpiDirectMatchã evl_string.h 324
ãã¹ãŠã®åæå€ãã¹ã€ããæ§æã§äœ¿çšãããããã§ã¯ãªããããã©ã«ãã®ãããã¯ããããŸããã ããã§piDirectMatchåŠçãè¿œå ããã®ãå¿ããå¯èœæ§ããããŸãã åæ§ã®èŠåãããå Žæã®ãªã¹ãïŒ
- V719 switchã¹ããŒãã¡ã³ãã¯ã 'PatternItemType'åæåã®ãã¹ãŠã®å€ãã«ããŒããããã§ã¯ãããŸããïŒpiDirectMatchãpiSkipMoreã evl_string.h 351
- V719 switchã¹ããŒãã¡ã³ãã¯ã 'PatternItemType'åæåã®ãã¹ãŠã®å€ãã«ããŒããããã§ã¯ãããŸããïŒpiDirectMatchã evl_string.h 368
- V719 switchã¹ããŒãã¡ã³ãã¯ã 'PatternItemType'åæåã®ãã¹ãŠã®å€ãã«ããŒããããã§ã¯ãããŸããïŒpiDirectMatchã evl_string.h 387
ãããã¡ãªãŒããŒãããŒ
const int GDS_NAME_LEN = 32; .... bool get_function(BurpGlobals* tdgbl) { .... struct isc_844_struct { .... short isc_870; /* gds__null_flag */ .... char isc_874 [125]; /* RDB$PACKAGE_NAME */ .... } isc_844; att_type attribute; TEXT temp[GDS_NAME_LEN * 2]; .... SSHORT prefixLen = 0; if (!/*X.RDB$PACKAGE_NAME.NULL*/ isc_844.isc_870) { prefixLen = static_cast<SSHORT>(strlen(/*X.RDB$PACKAGE_NAME*/ isc_844.isc_874)); memcpy(temp, /*X.RDB$PACKAGE_NAME*/ isc_844.isc_874, prefixLen); temp[prefixLen++] = '.'; } .... }
PVS-StudioèŠåïŒ V557ã¢ã¬ã€ããªãŒããŒã©ã³ããå¯èœæ§ããããŸãã 'prefixLen ++'ã€ã³ããã¯ã¹ã®å€ã¯124ã«éããå¯èœæ§ããããŸããrestore.cpp 10040
ãããã¡ãŒisc_844.isc_874ã®ãµã€ãºã¯ãããã125ã§ããã strlenïŒisc_844.isc_874ïŒã®å¯èœãªæ倧å€ã¯124ã§ããtempã®ãµã€ãºã¯64ã§ããã®å€ãããå°ãããªã£ãŠããŸãã ãã®ãããªã€ã³ããã¯ã¹ã§æžã蟌ããšããããã¡ãªãŒããŒãããŒãçºçããå¯èœæ§ããããŸãã äžæå€æ°ã«ããå€ãã®ã¡ã¢ãªãå²ãåœãŠãæ¹ãå®å šã§ãã
è² ã®ã·ãã
static ISC_STATUS stuff_literal(gen_t* gen, SLONG literal) { .... if (literal >= -32768 && literal <= 32767) return stuff_args(gen, 3, isc_sdl_short_integer, literal, literal >> 8); .... }
PVS-StudioèŠåïŒ V610äžç¹å®ã®åäœã ã·ããæŒç®åã>>ãã確èªããŠãã ããã å·Šã®ãªãã©ã³ãã¯è² ã§ãïŒ 'literal' = [-32768..32767]ïŒã array.cpp 848
ã³ãŒãã«ã¯ãè² ã®æ°ã®å³ã·ãããå«ãŸããŠããŸãã C ++æšæºã§ã¯ããã®ãããªã¢ã¯ã·ã§ã³ã«ã¯äžç¹å®ã®åäœããããŸããã€ãŸããã³ã³ãã€ã©ãšãã©ãããã©ãŒã ãç°ãªããšçµæãç°ãªãå¯èœæ§ããããŸãã 次ã®ããã«æžãçŽããŠãã ããïŒ
if (literal >= -32768 && literal <= 32767) return stuff_args(gen, 3, isc_sdl_short_integer, literal, (ULONG)literal >> 8);
èŠåãæ¶ããå¥ã®å ŽæïŒ
V610äžç¹å®ã®åäœã ã·ããæŒç®åã>>ãã確èªããŠãã ããã å·Šã®ãªãã©ã³ããè² ã§ãïŒ 'i64value' = [-2147483648..2147483647]ïŒã exprnodes.cpp 6382
å€æ°ãªãŒããŒã©ã€ã
THREAD_ENTRY_DECLARE Service::run(THREAD_ENTRY_PARAM arg) { int exit_code = -1; try { Service* svc = (Service*)arg; RefPtr<SvcMutex> ref(svc->svc_existence); int exit_code = svc->svc_service_run->serv_thd(svc); svc->started(); svc->svc_sem_full.release(); svc->finish(SVC_finished); } catch (const Exception& ex) { // Not much we can do here iscLogException("Exception in Service::run():", ex); } return (THREAD_ENTRY_RETURN)(IPTR) exit_code; }
PVS-StudioèŠåïŒ V561æ°ãã«å®£èšãããããã 'exit_code'å€æ°ã«å€ãå²ãåœãŠãæ¹ãããããè¯ãã§ãããã åã®å®£èšïŒsvc.cppãè¡1893ãsvc.cpp1898
ãã®äŸã§ã¯ãå²ãåœãŠã代ããã«ãå€æ°exit_codeããªãŒããŒã©ã€ããããŸãã ããã«ãããã¹ã³ãŒããã以åã®å€æ°ãé衚瀺ã«ãªãããã®çµæãé¢æ°ã¯åžžã«-1ã«çããç¡å¹ãªå€ãè¿ããŸãã
æ£ããã³ãŒãã¯æ¬¡ã®ãšããã§ãã
THREAD_ENTRY_DECLARE Service::run(THREAD_ENTRY_PARAM arg) { int exit_code = -1; try { Service* svc = (Service*)arg; RefPtr<SvcMutex> ref(svc->svc_existence); exit_code = svc->svc_service_run->serv_thd(svc); svc->started(); svc->svc_sem_full.release(); svc->finish(SVC_finished); } catch (const Exception& ex) { // Not much we can do here iscLogException("Exception in Service::run():", ex); } return (THREAD_ENTRY_RETURN)(IPTR) exit_code; }
ãããã«
åã®ãã¹ãã§èŠã€ãã£ãåé¡ã®ã»ãšãã©ã¯ããããžã§ã¯ãã®éçºè ã«ãã£ãŠä¿®æ£ãããçŸåšã¯ã³ãŒãå ã«ãããŸãããã€ãŸããã¢ãã©ã€ã¶ãŒã¯çŽ æŽãããä»äºãããŸããã ãã ããå®æçã«äœ¿çšããããšã§æè¯ã®çµæãåŸãããšãã§ããŸããããã«ãããæ©ã段éã§ãšã©ãŒããã£ããã§ããŸãã ã€ã³ã¯ãªã¡ã³ã¿ã«åæãšãã«ãã·ã¹ãã ãšã®äºææ§ã«ãããéçã¢ãã©ã€ã¶ãŒããããžã§ã¯ãã«ç°¡åã«çµ±åã§ããŸãã éçã¢ãã©ã€ã¶ãŒã䜿çšãããšãèšå€§ãªæéãç¯çŽã§ãããããã°ãåçåæã§ã¯æ€åºãå°é£ãªãšã©ãŒãèŠã€ããããšãã§ããŸãã
ãã®èšäºãè±èªã話ãèŽè¡ãšå ±æãããå Žåã¯ã翻蚳ãžã®ãªã³ã¯ã䜿çšããŠãã ããïŒPavel Belikovã Firebird 3.0ã®åæ ã
èšäºãèªãã§è³ªåããããŸããïŒ
å€ãã®å Žåãèšäºã«ã¯åã質åãå¯ããããŸãã ããã§åçãéããŸããïŒ PVS-StudioããŒãžã§ã³2015ã«é¢ããèšäºã®èªè
ããã®è³ªåãžã®åç ã ãªã¹ããã芧ãã ããã