std.cfg: Improved configuration of fprintf() and added TODO tests for wcsftime() when array count value exceeds bounds.
This commit is contained in:
parent
fab55287f7
commit
1942bd5679
|
@ -466,9 +466,11 @@
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1" direction="out">
|
<arg nr="1" direction="out">
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<minsize type="argvalue" arg="2"/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="2" direction="in">
|
<arg nr="2" direction="in">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
<valid>0:</valid>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="3" direction="in">
|
<arg nr="3" direction="in">
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
@ -1604,6 +1606,7 @@
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1" direction="inout">
|
<arg nr="1" direction="inout">
|
||||||
|
<!-- If stream is a null pointer, all streams are flushed. -->
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
|
@ -1900,6 +1903,7 @@
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<arg nr="2" direction="in">
|
<arg nr="2" direction="in">
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
|
<not-null/>
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
|
|
|
@ -292,7 +292,7 @@ void nullpointer(int value)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = 0;
|
fp = 0;
|
||||||
// No FP
|
// No FP
|
||||||
fflush(0);
|
fflush(0); // If stream is a null pointer, all streams are flushed.
|
||||||
fp = freopen(0,"abc",stdin);
|
fp = freopen(0,"abc",stdin);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
@ -435,6 +435,15 @@ void nullPointer_wcsftime(wchar_t* ptr, size_t maxsize, const wchar_t* format, c
|
||||||
(void)wcsftime(ptr, maxsize, format, timeptr);
|
(void)wcsftime(ptr, maxsize, format, timeptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bufferAccessOutOfBounds_wcsftime(wchar_t* ptr, size_t maxsize, const wchar_t* format, const struct tm* timeptr)
|
||||||
|
{
|
||||||
|
wchar_t buf[42];
|
||||||
|
(void)wcsftime(buf, 42, format, timeptr);
|
||||||
|
// TODO cppcheck-suppress bufferAccessOutOfBounds
|
||||||
|
(void)wcsftime(buf, 43, format, timeptr);
|
||||||
|
(void)wcsftime(ptr, maxsize, format, timeptr);
|
||||||
|
}
|
||||||
|
|
||||||
int nullPointer_wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n)
|
int nullPointer_wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n)
|
||||||
{
|
{
|
||||||
// cppcheck-suppress nullPointer
|
// cppcheck-suppress nullPointer
|
||||||
|
@ -1578,6 +1587,14 @@ void uninitvar_fmod(void)
|
||||||
(void)fmodl(ld1,ld2);
|
(void)fmodl(ld1,ld2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nullPointer_fprintf(FILE *Stream, char *Format, int Argument)
|
||||||
|
{
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void)fprintf(Stream, NULL, Argument);
|
||||||
|
// no warning is expected
|
||||||
|
(void)fprintf(Stream, Format, Argument);
|
||||||
|
}
|
||||||
|
|
||||||
void uninitvar_fprintf(FILE *Stream, char *Format, int Argument)
|
void uninitvar_fprintf(FILE *Stream, char *Format, int Argument)
|
||||||
{
|
{
|
||||||
FILE *stream1, *stream2;
|
FILE *stream1, *stream2;
|
||||||
|
|
|
@ -63,6 +63,23 @@ void invalidFunctionArg_fetestexcept(int excepts)
|
||||||
(void)std::fetestexcept(FE_ALL_EXCEPT+1);
|
(void)std::fetestexcept(FE_ALL_EXCEPT+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nullPointer_fprintf(FILE *Stream, char *Format, int Argument)
|
||||||
|
{
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void)std::fprintf(Stream, nullptr, Argument);
|
||||||
|
// no warning is expected
|
||||||
|
(void)std::fprintf(Stream, Format, Argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bufferAccessOutOfBounds_wcsftime(wchar_t* ptr, size_t maxsize, const wchar_t* format, const struct tm* timeptr)
|
||||||
|
{
|
||||||
|
wchar_t buf[42];
|
||||||
|
(void)std::wcsftime(buf, 42, format, timeptr);
|
||||||
|
// TODO cppcheck-suppress bufferAccessOutOfBounds
|
||||||
|
(void)std::wcsftime(buf, 43, format, timeptr);
|
||||||
|
(void)std::wcsftime(ptr, maxsize, format, timeptr);
|
||||||
|
}
|
||||||
|
|
||||||
int qsort_cmpfunc (const void * a, const void * b) {
|
int qsort_cmpfunc (const void * a, const void * b) {
|
||||||
return (*static_cast<const int*>(a) - *static_cast<const int*>(b));
|
return (*static_cast<const int*>(a) - *static_cast<const int*>(b));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue