Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
e757300f
Commit
e757300f
authored
Dec 25, 2017
by
Guolin Ke
Browse files
fix a potential problem in substr.
parent
72f2349a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
src/boosting/gbdt_model_text.cpp
src/boosting/gbdt_model_text.cpp
+3
-2
No files found.
src/boosting/gbdt_model_text.cpp
View file @
e757300f
...
@@ -335,9 +335,10 @@ bool GBDT::LoadModelFromString(const char* buffer, size_t len) {
...
@@ -335,9 +335,10 @@ bool GBDT::LoadModelFromString(const char* buffer, size_t len) {
}
}
else
if
(
strs
.
size
()
>
2
)
{
else
if
(
strs
.
size
()
>
2
)
{
if
(
strs
[
0
]
==
"feature_name"
)
{
if
(
strs
[
0
]
==
"feature_name"
)
{
key_vals
[
strs
[
0
]]
=
cur_line
.
substr
(
std
::
strlen
(
"feature_names="
))
.
c_str
()
;
key_vals
[
strs
[
0
]]
=
cur_line
.
substr
(
std
::
strlen
(
"feature_names="
));
}
else
{
}
else
{
Log
::
Fatal
(
"Wrong line at model file: %s"
,
cur_line
.
substr
(
0
,
128
).
c_str
());
// Use first 128 chars to avoid exceed the message buffer.
Log
::
Fatal
(
"Wrong line at model file: %s"
,
cur_line
.
substr
(
0
,
std
::
min
<
size_t
>
(
128
,
cur_line
.
size
())).
c_str
());
}
}
}
}
}
}
...
...
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