summaryrefslogtreecommitdiff
path: root/indra/lscript
diff options
context:
space:
mode:
Diffstat (limited to 'indra/lscript')
-rw-r--r--indra/lscript/lscript_compile/indra.l6
-rw-r--r--indra/lscript/lscript_compile/lscript_bytecode.cpp5
-rw-r--r--indra/lscript/lscript_execute/lscript_execute.cpp14
-rw-r--r--indra/lscript/lscript_execute/lscript_readlso.cpp14
4 files changed, 32 insertions, 7 deletions
diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l
index 524f2089fd..19c51b08b2 100644
--- a/indra/lscript/lscript_compile/indra.l
+++ b/indra/lscript/lscript_compile/indra.l
@@ -42,6 +42,12 @@ void parse_string();
#define YYLMAX 16384
#define YY_NEVER_INTERACTIVE 1 /* stops flex from calling isatty() */
+#ifdef ECHO
+#undef ECHO
+#endif
+
+#define ECHO do { } while (0)
+
#if defined(__cplusplus)
extern "C" { int yylex( void ); }
extern "C" { int yyparse( void ); }
diff --git a/indra/lscript/lscript_compile/lscript_bytecode.cpp b/indra/lscript/lscript_compile/lscript_bytecode.cpp
index d6b0fe4926..b91f53503b 100644
--- a/indra/lscript/lscript_compile/lscript_bytecode.cpp
+++ b/indra/lscript/lscript_compile/lscript_bytecode.cpp
@@ -288,7 +288,10 @@ void LLScriptScriptCodeChunk::build(FILE *efp, FILE *bcfp)
set_register(mCompleteCode, LREG_TM, mTotalSize);
- fwrite(mCompleteCode, 1, mTotalSize, bcfp);
+ if (fwrite(mCompleteCode, 1, mTotalSize, bcfp) != mTotalSize)
+ {
+ llwarns << "Short write" << llendl;
+ }
}
else
{
diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp
index 196ca07d1d..b166e922a2 100644
--- a/indra/lscript/lscript_execute/lscript_execute.cpp
+++ b/indra/lscript/lscript_execute/lscript_execute.cpp
@@ -43,11 +43,19 @@ LLScriptExecute::LLScriptExecute(FILE *fp)
U8 sizearray[4];
S32 filesize;
S32 pos = 0;
- fread(&sizearray, 1, 4, fp);
- filesize = bytestream2integer(sizearray, pos);
+ if (fread(&sizearray, 1, 4, fp) != 4)
+ {
+ llwarns << "Short read" << llendl;
+ filesize = 0;
+ } else {
+ filesize = bytestream2integer(sizearray, pos);
+ }
mBuffer = new U8[filesize];
fseek(fp, 0, SEEK_SET);
- fread(mBuffer, 1, filesize, fp);
+ if (fread(mBuffer, 1, filesize, fp) != filesize)
+ {
+ llwarns << "Short read" << llendl;
+ }
fclose(fp);
init();
diff --git a/indra/lscript/lscript_execute/lscript_readlso.cpp b/indra/lscript/lscript_execute/lscript_readlso.cpp
index 669a9b6a06..0021a87d65 100644
--- a/indra/lscript/lscript_execute/lscript_readlso.cpp
+++ b/indra/lscript/lscript_execute/lscript_readlso.cpp
@@ -17,11 +17,19 @@ LLScriptLSOParse::LLScriptLSOParse(FILE *fp)
U8 sizearray[4];
S32 filesize;
S32 pos = 0;
- fread(&sizearray, 1, 4, fp);
- filesize = bytestream2integer(sizearray, pos);
+ if (fread(&sizearray, 1, 4, fp) != 4)
+ {
+ llwarns << "Short read" << llendl;
+ filesize = 0;
+ } else {
+ filesize = bytestream2integer(sizearray, pos);
+ }
mRawData = new U8[filesize];
fseek(fp, 0, SEEK_SET);
- fread(mRawData, 1, filesize, fp);
+ if (fread(mRawData, 1, filesize, fp) != filesize)
+ {
+ llwarns << "Short read" << llendl;
+ }
initOpCodePrinting();
}