Skip to content

Fix OverflowException on 64bit due to bad cast #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/runtime/clrobject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal CLRObject(object ob, IntPtr tp)
{
IntPtr py = Runtime.PyType_GenericAlloc(tp, 0);

var flags = (int)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
var flags = (long)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
if ((flags & TypeFlags.Subclass) != 0)
{
IntPtr dict = Marshal.ReadIntPtr(py, ObjectOffset.DictOffset(tp));
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/debughelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal static void DumpType(IntPtr type)
internal static void DumpInst(IntPtr ob)
{
IntPtr tp = Runtime.PyObject_TYPE(ob);
var sz = (int)Marshal.ReadIntPtr(tp, TypeOffset.tp_basicsize);
var sz = (long)Marshal.ReadIntPtr(tp, TypeOffset.tp_basicsize);

for (var i = 0; i < sz; i += IntPtr.Size)
{
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/managedtype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal static ManagedType GetManagedObject(IntPtr ob)
tp = ob;
}

var flags = (int)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
var flags = (long)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
if ((flags & TypeFlags.Managed) != 0)
{
IntPtr op = tp == ob
Expand Down Expand Up @@ -63,7 +63,7 @@ internal static bool IsManagedType(IntPtr ob)
tp = ob;
}

var flags = (int)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
var flags = (long)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
if ((flags & TypeFlags.Managed) != 0)
{
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/metatype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public static void tp_dealloc(IntPtr tp)
{
// Fix this when we dont cheat on the handle for subclasses!

var flags = (int)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
var flags = (long)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
if ((flags & TypeFlags.Subclass) == 0)
{
IntPtr gc = Marshal.ReadIntPtr(tp, TypeOffset.magic());
Expand Down