fix out of range access to string

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9914 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
José Matox 2005-05-06 14:15:31 +00:00
parent ce8abc8a33
commit 63ebe9def7
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2005-05-06 José Matos <jamatos@lyx.org>
* insetcommandparams.C (scanCommand): fix out of range string access.
2005-05-05 Martin Vermeer <martin.vermeer@hut.fi>
* insetbibitem.C (bibitemMaxWidth): removed as obsolete

View File

@ -46,8 +46,7 @@ void InsetCommandParams::scanCommand(string const & cmd)
int nestdepth = 0;
for (string::size_type i = 0; i < cmd.length(); ++i) {
char c = cmd[i];
char b = cmd[i-1];
char const c = cmd[i];
if ((state == CMDNAME && c == ' ') ||
(state == CMDNAME && c == '[') ||
(state == CMDNAME && c == '{')) {
@ -72,7 +71,8 @@ void InsetCommandParams::scanCommand(string const & cmd)
case OPTION: toptions += c; break;
case SECOPTION: tsecoptions += c; break;
case CONTENT: tcontents += c; break;
case WS:
case WS: {
char const b = i? cmd[i-1]: 0;
if (c == '\\') {
state = CMDNAME;
} else if (c == '[' && b != ']') {
@ -87,6 +87,7 @@ void InsetCommandParams::scanCommand(string const & cmd)
}
break;
}
}
}
// Don't mess with this.