Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
INMOST
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Terekhov
INMOST
Commits
ab616c05
Commit
ab616c05
authored
Jun 04, 2017
by
Kirill Terekhov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing asserts for malloc
+prevent heap overflow due to big arrays in OldDrawGrid
parent
bfe393fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
Examples/OldDrawGrid/main.cpp
Examples/OldDrawGrid/main.cpp
+5
-3
Source/Mesh/mesh.cpp
Source/Mesh/mesh.cpp
+1
-0
Source/Solver/sparse.cpp
Source/Solver/sparse.cpp
+4
-0
No files found.
Examples/OldDrawGrid/main.cpp
View file @
ab616c05
...
...
@@ -106,7 +106,7 @@ void printtext(const char * fmt, ... )
{
unsigned
int
i
;
char
stext
[
1
048576
];
char
stext
[
1
31072
];
va_list
ap
;
if
(
fmt
==
NULL
)
return
;
va_start
(
ap
,
fmt
);
...
...
@@ -2110,6 +2110,7 @@ class kdtree
case
2
:
qsort
(
set
,
size
,
sizeof
(
entry
),
cmpElements2
);
break
;
}
children
=
static_cast
<
kdtree
*>
(
malloc
(
sizeof
(
kdtree
)
*
2
));
//new kdtree[2];
assert
(
children
!=
NULL
);
children
[
0
].
marked
=
0
;
children
[
0
].
children
=
NULL
;
children
[
0
].
set
=
set
;
...
...
@@ -3144,6 +3145,7 @@ class kdtree_picker
case
2
:
qsort
(
set
,
size
,
sizeof
(
entry
),
cmpElements2
);
break
;
}
children
=
static_cast
<
kdtree_picker
*>
(
malloc
(
sizeof
(
kdtree_picker
)
*
2
));
//new kdtree_picker[2];
assert
(
children
!=
NULL
);
children
[
0
].
children
=
NULL
;
children
[
0
].
set
=
set
;
children
[
0
].
size
=
size
/
2
;
...
...
@@ -4108,8 +4110,8 @@ double display_elem_info(Element e, double top, double left, double interval)
{
if
(
e
->
HaveData
(
*
t
)
)
{
char
str
[
1
048576
];
char
temp
[
1
048576
];
char
str
[
1
31072
];
char
temp
[
1
31072
];
str
[
0
]
=
'\0'
;
int
dsize
;
switch
(
t
->
GetDataType
())
...
...
Source/Mesh/mesh.cpp
View file @
ab616c05
...
...
@@ -2355,6 +2355,7 @@ namespace INMOST
void
Mesh
::
AllocateSparseData
(
void
*
&
q
,
const
Tag
&
tag
)
{
q
=
calloc
(
1
,
tag
.
GetRecordSize
());
assert
(
q
!=
NULL
);
#if defined(USE_AUTODIFF)
if
(
tag
.
GetDataType
()
==
DATA_VARIABLE
&&
tag
.
GetSize
()
!=
ENUMUNDEF
)
{
...
...
Source/Solver/sparse.cpp
View file @
ab616c05
...
...
@@ -689,12 +689,14 @@ namespace INMOST
int
n
;
input_ord
>>
n
;
ord
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
n
);
assert
(
ord
!=
NULL
);
for
(
int
i
=
0
;
i
<
n
;
i
++
)
input_ord
>>
ord
[
i
];
int
nbl
;
input_ord
>>
nbl
;
if
(
nbl
!=
size
)
throw
-
3
;
int
*
ibl
;
ibl
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
(
nbl
+
1
));
assert
(
ibl
!=
NULL
);
for
(
int
i
=
0
;
i
<
nbl
+
1
;
i
++
)
input_ord
>>
ibl
[
i
];
if
(
mbeg
==
ENUMUNDEF
)
mbeg
=
ibl
[
rank
];
if
(
mend
==
ENUMUNDEF
)
mend
=
ibl
[
rank
+
1
];
...
...
@@ -939,12 +941,14 @@ namespace INMOST
int
n
;
input_ord
>>
n
;
// check if( n == line )
ord
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
n
);
assert
(
ord
!=
NULL
);
for
(
int
i
=
0
;
i
<
n
;
i
++
)
input_ord
>>
ord
[
i
];
int
nbl
;
input_ord
>>
nbl
;
if
(
nbl
!=
size
)
throw
-
3
;
int
*
ibl
;
ibl
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
(
nbl
+
1
));
assert
(
ibl
!=
NULL
);
for
(
int
i
=
0
;
i
<
nbl
+
1
;
i
++
)
input_ord
>>
ibl
[
i
];
if
(
mbeg
==
ENUMUNDEF
)
mbeg
=
(
unsigned
int
)
ibl
[
rank
];
if
(
mend
==
ENUMUNDEF
)
mend
=
(
unsigned
int
)
ibl
[
rank
+
1
];
...
...
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