summaryrefslogtreecommitdiff
path: root/indra/lscript/lscript_execute
diff options
context:
space:
mode:
authorAaron Brashears <aaronb@lindenlab.com>2007-02-02 17:28:58 +0000
committerAaron Brashears <aaronb@lindenlab.com>2007-02-02 17:28:58 +0000
commit305c74d5163c5e344a675d39ca2394a9e45bd2c2 (patch)
tree42836c4a6010b2b015156024d3cfb6bf64a48ad6 /indra/lscript/lscript_execute
parent54d89549df38bb61881583a3eb8d3645c107d79f (diff)
Result of svn merge -r57264:57370 svn+ssh://svn/svn/linden/branches/adroit.r40-68 into release.
Diffstat (limited to 'indra/lscript/lscript_execute')
-rw-r--r--indra/lscript/lscript_execute/lscript_execute.cpp39
-rw-r--r--indra/lscript/lscript_execute/lscript_readlso.cpp8
2 files changed, 27 insertions, 20 deletions
diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp
index 3e52334d14..1cbcdc2c58 100644
--- a/indra/lscript/lscript_execute/lscript_execute.cpp
+++ b/indra/lscript/lscript_execute/lscript_execute.cpp
@@ -20,7 +20,7 @@
void (*binary_operations[LST_EOF][LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode);
void (*unary_operations[LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode);
-char *LSCRIPTRunTimeFaultStrings[LSRF_EOF] =
+char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/
{
"invalid", // LSRF_INVALID,
"Math Error", // LSRF_MATH,
@@ -2643,7 +2643,7 @@ BOOL run_jumpif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 size = toffset - string;
char *sdata = new char[size];
bytestream2char(sdata, buffer, string);
- if (strlen(sdata))
+ if (strlen(sdata)) /*Flawfinder: ignore*/
{
offset += arg;
}
@@ -2669,7 +2669,7 @@ BOOL run_jumpif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 size = toffset - string;
char *sdata = new char[size];
bytestream2char(sdata, buffer, string);
- if (strlen(sdata))
+ if (strlen(sdata)) /*Flawfinder: ignore*/
{
LLUUID id;
id.set(sdata);
@@ -2758,7 +2758,7 @@ BOOL run_jumpnif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 size = toffset - string;
char *sdata = new char[size];
bytestream2char(sdata, buffer, string);
- if (!strlen(sdata))
+ if (!strlen(sdata)) /*Flawfinder: ignore*/
{
offset += arg;
}
@@ -2784,7 +2784,7 @@ BOOL run_jumpnif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 size = toffset - string;
char *sdata = new char[size];
bytestream2char(sdata, buffer, string);
- if (strlen(sdata))
+ if (strlen(sdata)) /*Flawfinder: ignore*/
{
LLUUID id;
id.set(sdata);
@@ -2935,7 +2935,7 @@ S32 axtoi(char *hexStg)
BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
{
- char caststr[1024];
+ char caststr[1024]; /*Flawfinder: ignore*/
if (b_print)
printf("[0x%X]\tCAST ", offset);
offset++;
@@ -2968,7 +2968,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
case LST_STRING:
{
S32 address, source = lscript_pop_int(buffer);
- sprintf(caststr, "%d", source);
+ snprintf(caststr, sizeof(caststr), "%d", source); /*Flawfinder: ignore*/
address = lsa_heap_add_data(buffer, new LLScriptLibData(caststr), get_max_heap_size(buffer), TRUE);
lscript_push(buffer, address);
}
@@ -3005,7 +3005,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
{
S32 address;
F32 source = lscript_pop_float(buffer);
- sprintf(caststr, "%f", source);
+ snprintf(caststr, sizeof(caststr), "%f", source); /*Flawfinder: ignore*/
address = lsa_heap_add_data(buffer, new LLScriptLibData(caststr), get_max_heap_size(buffer), TRUE);
lscript_push(buffer, address);
}
@@ -3214,7 +3214,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 address;
LLVector3 source;
lscript_pop_vector(buffer, source);
- sprintf(caststr, "<%5.5f, %5.5f, %5.5f>", source.mV[VX], source.mV[VY], source.mV[VZ]);
+ snprintf(caststr, sizeof(caststr), "<%5.5f, %5.5f, %5.5f>", source.mV[VX], source.mV[VY], source.mV[VZ]); /*Flawfinder: ignore*/
address = lsa_heap_add_data(buffer, new LLScriptLibData(caststr), get_max_heap_size(buffer), TRUE);
lscript_push(buffer, address);
}
@@ -3247,7 +3247,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 address;
LLQuaternion source;
lscript_pop_quaternion(buffer, source);
- sprintf(caststr, "<%5.5f, %5.5f, %5.5f, %5.5f>", source.mQ[VX], source.mQ[VY], source.mQ[VZ], source.mQ[VS]);
+ snprintf(caststr, sizeof(caststr), "<%5.5f, %5.5f, %5.5f, %5.5f>", source.mQ[VX], source.mQ[VY], source.mQ[VZ], source.mQ[VS]); /*Flawfinder: ignore*/
address = lsa_heap_add_data(buffer, new LLScriptLibData(caststr), get_max_heap_size(buffer), TRUE);
lscript_push(buffer, address);
}
@@ -3571,22 +3571,29 @@ void lscript_run(char *filename, BOOL b_debug)
char *error;
BOOL b_state;
LLScriptExecute *execute = NULL;
- FILE *file = LLFile::fopen(filename, "r");
+ if (filename == NULL)
+ {
+ llerrs << "filename is empty" << llendl;
+ // Just reporting error is likely not enough. Need
+ // to check how to abort or error out gracefully
+ // from this function. XXXTBD
+ }
+ FILE* file = LLFile::fopen(filename, "r"); /* Flawfinder: ignore */
if (file)
{
execute = new LLScriptExecute(file);
fclose(file);
}
- file = LLFile::fopen(filename, "r");
+ file = LLFile::fopen(filename, "r"); /* Flawfinder: ignore */
if (file)
{
- FILE *fp = LLFile::fopen("lscript.parse", "w");
+ FILE* fp = LLFile::fopen("lscript.parse", "w"); /*Flawfinder: ignore*/
LLScriptLSOParse *parse = new LLScriptLSOParse(file);
parse->printData(fp);
fclose(file);
fclose(fp);
}
- file = LLFile::fopen(filename, "r");
+ file = LLFile::fopen(filename, "r"); /*Flawfinder: ignore*/
if (file && execute)
{
timer.reset();
@@ -3795,7 +3802,7 @@ BOOL run_calllib(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
if (gScriptLibrary.mFunctions[arg]->mArgs)
{
- number = (S32)strlen(gScriptLibrary.mFunctions[arg]->mArgs);
+ number = (S32)strlen(gScriptLibrary.mFunctions[arg]->mArgs); /*Flawfinder: ignore*/
arguments = new LLScriptLibData[number];
}
else
@@ -3866,7 +3873,7 @@ BOOL run_calllib_two_byte(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &i
if (gScriptLibrary.mFunctions[arg]->mArgs)
{
- number = (S32)strlen(gScriptLibrary.mFunctions[arg]->mArgs);
+ number = (S32)strlen(gScriptLibrary.mFunctions[arg]->mArgs); /*Flawfinder: ignore*/
arguments = new LLScriptLibData[number];
}
else
diff --git a/indra/lscript/lscript_execute/lscript_readlso.cpp b/indra/lscript/lscript_execute/lscript_readlso.cpp
index 2219232a3e..e92c1d2312 100644
--- a/indra/lscript/lscript_execute/lscript_readlso.cpp
+++ b/indra/lscript/lscript_execute/lscript_readlso.cpp
@@ -103,7 +103,7 @@ void LLScriptLSOParse::printGlobals(FILE *fp)
F32 fpvalue;
LLVector3 vvalue;
LLQuaternion qvalue;
- char name[256];
+ char name[256]; /*Flawfinder: ignore*/
U8 type;
S32 global_v_offset = get_register(mRawData, LREG_GVR);
@@ -171,7 +171,7 @@ void LLScriptLSOParse::printGlobalFunctions(FILE *fp)
S32 i, offset;
// LLVector3 vvalue; unused
// LLQuaternion qvalue; unused
- char name[256];
+ char name[256]; /*Flawfinder: ignore*/
U8 type;
offset = get_register(mRawData, LREG_GFR);
@@ -261,7 +261,7 @@ void LLScriptLSOParse::printStates(FILE *fp)
U32 j, k;
// LLVector3 vvalue; unused
// LLQuaternion qvalue; unused
- char name[256];
+ char name[256]; /*Flawfinder: ignore*/
S32 state_offset = get_register(mRawData, LREG_SR);
@@ -1177,7 +1177,7 @@ void print_pushargf(FILE *fp, U8 *buffer, S32 &offset, S32 tabs)
void print_pushargs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs)
{
- char arg[1024];
+ char arg[1024]; /*Flawfinder: ignore*/
lso_print_tabs(fp, tabs);
fprintf(fp, "[0x%X]\tPUSHARGS ", offset++);
bytestream2char(arg, buffer, offset);