1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-17 23:56:05 +02:00

Small fixes

This commit is contained in:
Brian Fiete 2019-09-18 08:18:20 -07:00
parent 4a809f3364
commit 4f2472c276
5 changed files with 62 additions and 22 deletions

View file

@ -2,6 +2,7 @@ using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace IDE.util
{
class ResourceGen
@ -77,7 +78,6 @@ namespace IDE.util
}
let iconDir = Try!(stream.Read<IconDir>());
if ((iconDir.mReserved != 0) || (iconDir.mType != 1) || (iconDir.mCount > 0x100))
{
gApp.OutputErrorLine("Invalid file format: {0}", iconFile);
@ -97,6 +97,12 @@ namespace IDE.util
Try!(stream.Seek(iconEntry.mImageOffset));
if (iconEntry.mBytesInRes > 1024*1024)
{
gApp.OutputErrorLine("Invalid icon entry in: {0}", iconFile);
return .Err;
}
uint8* data = new:ScopedAlloc! uint8[iconEntry.mBytesInRes]*;
Try!(stream.TryRead(.(data, iconEntry.mBytesInRes)));