[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (bf9aa530be0cd35dcf12e64f5bad6315652bff11)



The branch, master has been updated
       via  bf9aa530be0cd35dcf12e64f5bad6315652bff11 (commit)
       via  cf2586a52565f3306c5c7ca6f54bad0b26f84888 (commit)
      from  ed9a9d0cd9d054e6fc4a075ec1b8d9a12f1cb376 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/action.c |    1 +
 src/create.c |    1 -
 2 files changed, 1 insertions(+), 1 deletions(-)


=================
 Commit Messages
=================

commit bf9aa530be0cd35dcf12e64f5bad6315652bff11
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    create.c: Don't emit RouteStylesChanged from within CreateNewPCB()
    
    The route style selector is hanging onto pointers of the
    current PCB's route styles. When the action "RouteStylesChanged"
    is called, these are compared against the current route style
    to identify which one the GUI should show as selected.
    
    When this call comes from within CreateNewPCB, and the OLD
    PCB has already been free'd, this causes free'd memory to be read,
    resulting in valgrind output such as:
    
        ==22404== Invalid read of size 8
        ==22404==    at 0x4D82B3: ghid_route_style_selector_sync (ghid-route-style-selector.c:594)
        ==22404==    by 0x4BAB28: RouteStylesChanged (gtkhid-main.c:1157)
        ==22404==    by 0x49E0D3: hid_actionv (actions.c:247)
        ==22404==    by 0x447B7B: CreateNewPCB (create.c:194)
        ==22404==    by 0x4273E8: ActionNew (action.c:5902)
        ==22404==  Address 0xd3c4458 is 13,880 bytes inside a block of size 14,120 free'd
        ==22404==    at 0x4C282E0: free (vg_replace_malloc.c:366)
        ==22404==    by 0x4273DE: ActionNew (action.c:5901)
    
    
    Strictly speaking though - since CreateNewPCB does not directly
    assign to the current PCB variable - it has no business in calling
    the "RouteStylesChanged" action anyway.
    
    Suitable update is taken care of later on in ActionNew(), as it
    calls the "PCBChanged" action - the GTK implementation of which
    in turn updates the route selector correctly.
    
    Closes-bug: lp-856909

:100644 100644 c843582... a199acc... M	src/create.c

commit cf2586a52565f3306c5c7ca6f54bad0b26f84888
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    action.c: Set PCB = NULL; after freeing it in ActionNew()
    
    When we call CreateNewPCB(), it trips over some code which wants
    to access the current PCB in order to determine whether to
    auto-save at exit. The code in question does check if PCB is
    NULL first, so this is a sufficient fix for this case.
    
    Fixes valgrind output such as:
    
        ==22404== Invalid read of size 8
        ==22404==    at 0x470944: Parse (parse_l.l:282)
        ==22404==    by 0x471913: ParseFont (parse_l.l:356)
        ==22404==    by 0x447973: CreateDefaultFont (create.c:941)
        ==22404==    by 0x447C58: CreateNewPCB (create.c:211)
        ==22404==    by 0x4273E8: ActionNew (action.c:5902)
        ==22404==  Address 0xd3c4538 is 14,104 bytes inside a block of size 14,120 free'd
        ==22404==    at 0x4C282E0: free (vg_replace_malloc.c:366)
        ==22404==    by 0x4273DE: ActionNew (action.c:5901)
    
    Which is seen when starting an new layout from within PCB.
    
    Affects-bug: lp-856909

:100644 100644 2edb9a9... 62c53e3... M	src/action.c

=========
 Changes
=========

commit bf9aa530be0cd35dcf12e64f5bad6315652bff11
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    create.c: Don't emit RouteStylesChanged from within CreateNewPCB()
    
    The route style selector is hanging onto pointers of the
    current PCB's route styles. When the action "RouteStylesChanged"
    is called, these are compared against the current route style
    to identify which one the GUI should show as selected.
    
    When this call comes from within CreateNewPCB, and the OLD
    PCB has already been free'd, this causes free'd memory to be read,
    resulting in valgrind output such as:
    
        ==22404== Invalid read of size 8
        ==22404==    at 0x4D82B3: ghid_route_style_selector_sync (ghid-route-style-selector.c:594)
        ==22404==    by 0x4BAB28: RouteStylesChanged (gtkhid-main.c:1157)
        ==22404==    by 0x49E0D3: hid_actionv (actions.c:247)
        ==22404==    by 0x447B7B: CreateNewPCB (create.c:194)
        ==22404==    by 0x4273E8: ActionNew (action.c:5902)
        ==22404==  Address 0xd3c4458 is 13,880 bytes inside a block of size 14,120 free'd
        ==22404==    at 0x4C282E0: free (vg_replace_malloc.c:366)
        ==22404==    by 0x4273DE: ActionNew (action.c:5901)
    
    
    Strictly speaking though - since CreateNewPCB does not directly
    assign to the current PCB variable - it has no business in calling
    the "RouteStylesChanged" action anyway.
    
    Suitable update is taken care of later on in ActionNew(), as it
    calls the "PCBChanged" action - the GTK implementation of which
    in turn updates the route selector correctly.
    
    Closes-bug: lp-856909

diff --git a/src/create.c b/src/create.c
index c843582..a199acc 100644
--- a/src/create.c
+++ b/src/create.c
@@ -191,7 +191,6 @@ CreateNewPCB (bool SetDefaultNames)
     style->index = n;
   }
   END_LOOP;
-  hid_action ("RouteStylesChanged");
   ptr->Zoom = Settings.Zoom;
   ptr->MaxWidth = Settings.MaxWidth;
   ptr->MaxHeight = Settings.MaxHeight;

commit cf2586a52565f3306c5c7ca6f54bad0b26f84888
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    action.c: Set PCB = NULL; after freeing it in ActionNew()
    
    When we call CreateNewPCB(), it trips over some code which wants
    to access the current PCB in order to determine whether to
    auto-save at exit. The code in question does check if PCB is
    NULL first, so this is a sufficient fix for this case.
    
    Fixes valgrind output such as:
    
        ==22404== Invalid read of size 8
        ==22404==    at 0x470944: Parse (parse_l.l:282)
        ==22404==    by 0x471913: ParseFont (parse_l.l:356)
        ==22404==    by 0x447973: CreateDefaultFont (create.c:941)
        ==22404==    by 0x447C58: CreateNewPCB (create.c:211)
        ==22404==    by 0x4273E8: ActionNew (action.c:5902)
        ==22404==  Address 0xd3c4538 is 14,104 bytes inside a block of size 14,120 free'd
        ==22404==    at 0x4C282E0: free (vg_replace_malloc.c:366)
        ==22404==    by 0x4273DE: ActionNew (action.c:5901)
    
    Which is seen when starting an new layout from within PCB.
    
    Affects-bug: lp-856909

diff --git a/src/action.c b/src/action.c
index 2edb9a9..62c53e3 100644
--- a/src/action.c
+++ b/src/action.c
@@ -5899,6 +5899,7 @@ ActionNew (int argc, char **argv, Coord x, Coord y)
       if (PCB->Changed && Settings.SaveInTMP)
 	SaveInTMP ();
       RemovePCB (PCB);
+      PCB = NULL;
       PCB = CreateNewPCB (true);
       PCB->Data->LayerN = DEF_LAYER;
       CreateNewPCBPost (PCB, 1);




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs