Skip to content

Commit b82e853

Browse files
authored
Merge pull request ArtifexSoftware#54 from brandondahler/bugfix/32bitProcessOverflow
Fix Arithmetic overflow error at DynamicNativeLibrary.FinalizeSections when running on x86
2 parents 49a233f + b9aa524 commit b82e853

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Ghostscript.NET/Microsoft.WinAny.Helper/Interop/DynamicNativeLibrary.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ private void FinalizeSections(MEMORY_MODULE* memory_module)
531531
if ((section->Characteristics & WinNT.IMAGE_SCN_MEM_DISCARDABLE) != 0)
532532
{
533533
// section is not needed any more and can safely be freed
534-
WinBase.VirtualFree((IntPtr)((long)section->PhysicalAddress | (long)image_offset), section->SizeOfRawData, WinNT.MEM_DECOMMIT);
534+
WinBase.VirtualFree((IntPtr)(void*)((long)section->PhysicalAddress | (long)image_offset), section->SizeOfRawData, WinNT.MEM_DECOMMIT);
535535
continue;
536536
}
537537

@@ -555,7 +555,7 @@ private void FinalizeSections(MEMORY_MODULE* memory_module)
555555
if (rawDataSize > 0)
556556
{
557557
// change memory access flags
558-
WinBase.VirtualProtect((IntPtr)((long)section->PhysicalAddress | (long)image_offset), rawDataSize, protect, &oldProtect);
558+
WinBase.VirtualProtect((IntPtr)(void*)((long)section->PhysicalAddress | (long)image_offset), rawDataSize, protect, &oldProtect);
559559
}
560560
}
561561
}

0 commit comments

Comments
 (0)