- Fixed: The TEXTURES parser could copy beyond the end of a string when parsing

a 'define' definition.


SVN r1263 (trunk)
This commit is contained in:
Christoph Oelckers 2008-10-14 07:57:16 +00:00
parent 738e8ca7ad
commit bca1fc5068
2 changed files with 35 additions and 26 deletions

View File

@ -14,6 +14,10 @@ October 13, 2008
player's inventory when death caused the morph to revert.
- Updated fmod_wrap.h for FMOD Ex 4.18.
October 10, 2008 (Changes by Graf Zahl)
- Fixed: The TEXTURES parser could copy beyond the end of a string when parsing
a 'define' definition.
October 7, 2008 (Changes by Graf Zahl)
- Fixed: Cheats in demos must not access the weapon slots.
- Fixed: S_ChannelEnded didn't check for a NULL SfxInfo.

View File

@ -535,38 +535,43 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
else if (sc.Compare("define")) // define a new "fake" texture
{
sc.GetString();
memcpy(src, ExtractFileBase(sc.String, false), 8);
int lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_patches);
if (lumpnum == -1) lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_graphics);
sc.GetString();
is32bit = !!sc.Compare("force32bit");
if (!is32bit) sc.UnGet();
sc.GetNumber();
width = sc.Number;
sc.GetNumber();
height = sc.Number;
if (lumpnum>=0)
FString base = ExtractFileBase(sc.String, false);
if (!base.IsEmpty())
{
FTexture *newtex = FTexture::CreateTexture(lumpnum, FTexture::TEX_Override);
strncpy(src, base, 8);
if (newtex != NULL)
int lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_patches);
if (lumpnum == -1) lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_graphics);
sc.GetString();
is32bit = !!sc.Compare("force32bit");
if (!is32bit) sc.UnGet();
sc.GetNumber();
width = sc.Number;
sc.GetNumber();
height = sc.Number;
if (lumpnum>=0)
{
// Replace the entire texture and adjust the scaling and offset factors.
newtex->bWorldPanning = true;
newtex->SetScaledSize(width, height);
memcpy(newtex->Name, src, sizeof(newtex->Name));
FTexture *newtex = FTexture::CreateTexture(lumpnum, FTexture::TEX_Override);
FTextureID oldtex = TexMan.CheckForTexture(src, FTexture::TEX_MiscPatch);
if (oldtex.isValid())
if (newtex != NULL)
{
ReplaceTexture(oldtex, newtex, true);
newtex->UseType = FTexture::TEX_Override;
// Replace the entire texture and adjust the scaling and offset factors.
newtex->bWorldPanning = true;
newtex->SetScaledSize(width, height);
memcpy(newtex->Name, src, sizeof(newtex->Name));
FTextureID oldtex = TexMan.CheckForTexture(src, FTexture::TEX_MiscPatch);
if (oldtex.isValid())
{
ReplaceTexture(oldtex, newtex, true);
newtex->UseType = FTexture::TEX_Override;
}
else AddTexture(newtex);
}
else AddTexture(newtex);
}
}
//else Printf("Unable to define hires texture '%s'\n", tex->Name);