FIRE-31718 - truncate preprocessed lsl script text in case of an error to prevent the viewer from stalling while trying to fit a massive blob of text into the script editor

master
Zi Ree 2022-06-22 03:20:54 +02:00
parent d095f199c6
commit 820799e193
2 changed files with 17 additions and 0 deletions

View File

@ -1540,6 +1540,22 @@ void FSLSLPreprocessor::start_process()
}
}
}
else
{
// FIRE-31718: Preprocessor crashes viewer on recursive #include
// Truncate the resulting preprocessed script to something the text field can handle without
// freezing for so long the viewer disconnects. The usual script source code limit is 64kB so
// let's play it safe and allow twice as much here. The script is most likely already unusable
// at this point due to the preprocessor bailing out with an error earlier, so a truncated
// version doesn't hurt more than it already did.
if (output.size() > 128 * 1024)
{
output.resize(128 * 1024);
display_error(LLTrans::getString("fs_preprocessor_truncated"));
}
}
if (!errored)
{
if (preprocessor_enabled && use_compression)

View File

@ -3153,6 +3153,7 @@ Your current position: [AVATAR_POS]
<string name="fs_preprocessor_cache_completed">Caching completed for '[FILENAME]'</string>
<string name="fs_preprocessor_cache_unsafe">Error: script named '[FILENAME]' isn't safe to copy to the filesystem. This include will fail.</string>
<string name="fs_preprocessor_caching_err">Error caching included file '[FILENAME]'</string>
<string name="fs_preprocessor_truncated">Warning: Preprocessor output truncated due to excessive script text size. This script will most likely not work.</string>
<!-- </FS:Cron> -->
<!-- Animation Explorer -->