Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
c289a481
Commit
c289a481
authored
5 years ago
by
maxim_productengine
Browse files
Options
Downloads
Patches
Plain Diff
SL-11191 FIXED Crash in LLCommandLineParser::parseCommandLineString(..)
parent
8101b709
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/llcommandlineparser.cpp
+32
-4
32 additions, 4 deletions
indra/newview/llcommandlineparser.cpp
with
32 additions
and
4 deletions
indra/newview/llcommandlineparser.cpp
+
32
−
4
View file @
c289a481
...
...
@@ -374,12 +374,40 @@ bool LLCommandLineParser::parseCommandLine(int argc, char **argv)
bool
LLCommandLineParser
::
parseCommandLineString
(
const
std
::
string
&
str
)
{
std
::
string
cmd_line_string
(
""
);
if
(
!
str
.
empty
())
{
bool
add_last_c
=
true
;
S32
last_c_pos
=
str
.
size
()
-
1
;
//don't get out of bounds on pos+1, last char will be processed separately
for
(
S32
pos
=
0
;
pos
<
last_c_pos
;
++
pos
)
{
cmd_line_string
.
append
(
&
str
[
pos
],
1
);
if
(
str
[
pos
]
==
'\\'
)
{
cmd_line_string
.
append
(
"
\\
"
,
1
);
if
(
str
[
pos
+
1
]
==
'\\'
)
{
++
pos
;
add_last_c
=
(
pos
!=
last_c_pos
);
}
}
}
if
(
add_last_c
)
{
cmd_line_string
.
append
(
&
str
[
last_c_pos
],
1
);
if
(
str
[
last_c_pos
]
==
'\\'
)
{
cmd_line_string
.
append
(
"
\\
"
,
1
);
}
}
}
// Split the string content into tokens
const
char
*
escape_chars
=
"
\\
"
;
const
char
*
separator_chars
=
"
\r\n
"
;
const
char
*
quote_chars
=
"
\"
'"
;
const
char
*
escape_chars
=
"
\\
"
;
const
char
*
separator_chars
=
"
\r\n
"
;
const
char
*
quote_chars
=
"
\"
'"
;
boost
::
escaped_list_separator
<
char
>
sep
(
escape_chars
,
separator_chars
,
quote_chars
);
boost
::
tokenizer
<
boost
::
escaped_list_separator
<
char
>
>
tok
(
str
,
sep
);
boost
::
tokenizer
<
boost
::
escaped_list_separator
<
char
>
>
tok
(
cmd_line_string
,
sep
);
std
::
vector
<
std
::
string
>
tokens
;
// std::copy(tok.begin(), tok.end(), std::back_inserter(tokens));
for
(
boost
::
tokenizer
<
boost
::
escaped_list_separator
<
char
>
>::
iterator
i
=
tok
.
begin
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment