Fixed crash in BVHDecoder - ReadBytesUntilNull was reading until newline instead of null

Fixed crash in PrimMesher - Profile::Copy was not copying correctly
Fixed crash in PrmiMesher - SculptMap::ScaleImage was disposing live SKBitmap's
This commit is contained in:
nooperation
2025-03-12 23:43:00 -04:00
parent 6425cf630b
commit ccfa54524b
3 changed files with 13 additions and 3 deletions

View File

@@ -181,7 +181,7 @@ namespace OpenMetaverse
for (var j = i; j < data.Length; j++)
{
char spot = Convert.ToChar(data[j]);
if (spot == '\n')
if (spot == '\0')
{
endpos = j;
break;

View File

@@ -1058,7 +1058,9 @@ namespace LibreMetaverse.PrimMesher
if (needFaces)
copy.faces.AddRange(faces);
if (copy.calcVertexNormals == calcVertexNormals)
copy.calcVertexNormals = calcVertexNormals;
if (calcVertexNormals)
{
copy.vertexNormals.AddRange(vertexNormals);
copy.faceNormal = faceNormal;

View File

@@ -121,6 +121,10 @@ namespace LibreMetaverse.PrimMesher
}
catch (Exception e)
{
if (needsScaling)
{
bm.Dispose();
}
throw new Exception("Caught exception processing byte arrays in SculptMap(): e: " + e);
}
@@ -129,6 +133,11 @@ namespace LibreMetaverse.PrimMesher
width++;
height++;
}
if (needsScaling)
{
bm.Dispose();
}
}
public List<List<Coord>> ToRows(bool mirror)
@@ -167,7 +176,6 @@ namespace LibreMetaverse.PrimMesher
var info = new SKImageInfo(destWidth, destHeight);
var scaledImage = new SKBitmap(info);
srcImage.ScalePixels(scaledImage.PeekPixels(), new SKSamplingOptions(SKFilterMode.Linear));
srcImage.Dispose();
return scaledImage;
}
}