View Issue Details

IDProjectCategoryView StatusLast Update
0037772FPCFree Visionpublic2020-09-18 21:29
ReporterJoe care Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86-64OSWin64 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0037772: Pointer-conversion to longint might fail in x64-bit environment.
DescriptionOn 2(3) places in Free Vision a pointer is converted to longint this might fail in x64-bit environments (even when it's very unlikely.)
even converting an Pointer to PtrInt might be safe but gives warning about signed/unsigned comparison.
Additional Informationreplaced longint with PtrUInt ...
Patch provited
TagsNo tags attached.
Fixed in Revision46893
FPCOldBugId
FPCTarget-
Attached Files

Activities

Joe care

2020-09-18 18:07

reporter  

fv_src.patch (2,214 bytes)   
Index: drivers.pas
===================================================================
--- drivers.pas	(Revision 46892)
+++ drivers.pas	(Arbeitskopie)
@@ -1375,7 +1375,7 @@
       GetVideoMode(ScreenMode);
     end;
 
-  if ScreenWidth > MaxViewWidth then
+  if ScreenWidth >= MaxViewWidth then
     ScreenWidth := MaxViewWidth;
   ScreenWidth:=Video.ScreenWidth;
   ScreenHeight:=Video.ScreenHeight;
Index: sysmsg.pas
===================================================================
--- sysmsg.pas	(Revision 46892)
+++ sysmsg.pas	(Arbeitskopie)
@@ -104,7 +104,7 @@
    begin
      PendingSystemTail^:=SystemEvent;
      inc(PendingSystemTail);
-     if longint(PendingSystemTail)=longint(@PendingSystemEvent)+sizeof(PendingSystemEvent) then
+     if PtrUInt(PendingSystemTail)=PtrUInt(@PendingSystemEvent)+sizeof(PendingSystemEvent) then
       PendingSystemTail:=@PendingSystemEvent;
        inc(PendingSystemEvents);
    end;
Index: views.pas
===================================================================
--- views.pas	(Revision 46892)
+++ views.pas	(Arbeitskopie)
@@ -2117,7 +2117,7 @@
      Tp := Last;                                      { Set temporary ptr }
      Repeat
        Tp := Tp^.Next;                                { Get next view }
-         IF Byte(Longint(CallPointerMethodLocal(TCallbackFunBoolParam(P),
+         IF Byte(PtrUInt(CallPointerMethodLocal(TCallbackFunBoolParam(P),
          { On most systems, locals are accessed relative to base pointer,
            but for MIPS cpu, they are accessed relative to stack pointer.
            This needs adaptation for so low level routines,
Index: w32smsg.inc
===================================================================
--- w32smsg.inc	(Revision 46892)
+++ w32smsg.inc	(Arbeitskopie)
@@ -145,7 +145,7 @@
   EnterCriticalSection(ChangeSystemEvents);
   SystemEvent:=PendingSystemHead^;
   inc(PendingSystemHead);
-  if ptrint(PendingSystemHead)=ptrint(@PendingSystemEvent)+sizeof(PendingSystemEvent) then
+  if PtrUInt(PendingSystemHead)=PtrUInt(@PendingSystemEvent)+sizeof(PendingSystemEvent) then
    PendingSystemHead:=@PendingSystemEvent;
   dec(PendingSystemEvents);
   LastSystemEvent:=SystemEvent;
fv_src.patch (2,214 bytes)   

Florian

2020-09-18 21:29

administrator   ~0125630

Thanks, applied (without the unrelated change to drivers.pas).

Issue History

Date Modified Username Field Change
2020-09-18 18:07 Joe care New Issue
2020-09-18 18:07 Joe care File Added: fv_src.patch
2020-09-18 21:29 Florian Assigned To => Florian
2020-09-18 21:29 Florian Status new => resolved
2020-09-18 21:29 Florian Resolution open => fixed
2020-09-18 21:29 Florian Fixed in Version => 3.3.1
2020-09-18 21:29 Florian Fixed in Revision => 46893
2020-09-18 21:29 Florian FPCTarget => -
2020-09-18 21:29 Florian Note Added: 0125630