Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b911cfdd
Commit
b911cfdd
authored
Jul 23, 2013
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add modeling file for Coverity Scan.
The modeling file avoids false positive reports.
parent
ba30883f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
0 deletions
+112
-0
Misc/coverity_model.c
Misc/coverity_model.c
+112
-0
No files found.
Misc/coverity_model.c
0 → 100644
View file @
b911cfdd
/* Coverity Scan model
*
* This is a modeling file for Coverity Scan. Modeling helps to avoid false
* positives.
*
* - A model file can't import any header files.
* - Therefore only some built-in primitives like int, char and void are
* available but not wchar_t, NULL etc.
* - Modeling doesn't need full structs and typedefs. Rudimentary structs
* and similar types are sufficient.
* - An uninitialized local pointer is not an error. It signifies that the
* variable could be either NULL or have some data.
*
* Coverity Scan doesn't pick up modifications automatically. The model file
* must be uploaded by an admin in the analysis settings of
* http://scan.coverity.com/projects/200
*
*/
/* dummy definitions, in most cases struct fields aren't required. */
#define NULL (void *)0
typedef
int
sdigit
;
typedef
long
Py_ssize_t
;
typedef
unsigned
short
wchar_t
;
typedef
struct
{}
PyObject
;
typedef
struct
{}
grammar
;
typedef
int
sdigit
;
typedef
struct
{}
DIR
;
typedef
struct
{}
RFILE
;
/* Python/pythonrun.c
* resourece leak false positive */
void
Py_FatalError
(
const
char
*
msg
)
{
__coverity_panic__
();
}
/* Objects/longobject.c
* NEGATIVE_RETURNS false positive */
static
PyObject
small_ints
[
257
+
5
];
static
PyObject
*
get_small_int
(
sdigit
ival
)
{
PyObject
*
p
;
if
(((
ival
+
5
)
>=
0
)
&&
((
ival
+
5
)
<
257
+
5
))
{
return
&
small_ints
[
ival
+
5
];
}
return
p
;
}
/* tainted sinks
*
* Coverity considers argv, environ, read() data etc as tained.
*/
PyObject
*
PyErr_SetFromErrnoWithFilename
(
PyObject
*
exc
,
const
char
*
filename
)
{
__coverity_tainted_data_sink__
(
filename
);
return
NULL
;
}
/* Python/fileutils.c */
wchar_t
*
_Py_char2wchar
(
const
char
*
arg
,
size_t
*
size
)
{
wchar_t
*
w
;
__coverity_tainted_data_sink__
(
arg
);
__coverity_tainted_data_sink__
(
size
);
return
w
;
}
/* Parser/pgenmain.c */
grammar
*
getgrammar
(
char
*
filename
)
{
grammar
*
g
;
__coverity_tainted_data_sink__
(
filename
);
return
g
;
}
/* Python/marshal.c */
static
Py_ssize_t
r_string
(
char
*
s
,
Py_ssize_t
n
,
RFILE
*
p
)
{
__coverity_tainted_string_argument__
(
s
);
return
0
;
}
static
long
r_long
(
RFILE
*
p
)
{
long
l
;
unsigned
char
buffer
[
4
];
r_string
((
char
*
)
buffer
,
4
,
p
);
__coverity_tainted_string_sanitize_content__
(
buffer
);
l
=
(
long
)
buffer
;
return
l
;
}
/* Coverity doesn't understand that fdopendir() may take ownership of fd. */
DIR
*
fdopendir
(
int
fd
)
{
DIR
*
d
;
if
(
d
)
{
__coverity_close__
(
fd
);
}
return
d
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment