Re: [Kicad-developers] Segmentation Fault when creating a copper zone

2020-08-21 Thread Augusto Fraga Giachero
Hi Nick,

It seems that Seth Hillbrand already commited a fix to it.

Augusto.

Nick Østergaard writes:

> Please submit it directly on gitlab as a merge request.
>
> https://gitlab.com/kicad/code/kicad
>
> fre. 21. aug. 2020 14.17 skrev Augusto Fraga Giachero >:
>
>> Hi,
>>
>> I've experienced crashes in pcbnew when creating a cooper fill zone when
>> no board edges has been defined. Tuns out that BuildBoardPolygonOutlines
>> is called with aErrorText set to nullptr an it tries to deference it to
>> write an error message when no board edges has been found.
>>
>> The attached patch checks aErrorText and only deference it if it is not
>> nullptr.
>>
>> Upon further investigation I discovered that the overloaded method
>> BOARD::GetBoardPolygonOutlines is called from ZONE_FILLER::Fill with its
>> default values of aErrorText and aErrorLocation (both nullptr). Wouldn't
>> be better to supply a valid pointer to aErrorText to inform the user
>> about the error / warning in this case?
>>
>> Thanks,
>> Augusto.
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Segmentation Fault when creating a copper zone

2020-08-21 Thread Nick Østergaard
Please submit it directly on gitlab as a merge request.

https://gitlab.com/kicad/code/kicad

fre. 21. aug. 2020 14.17 skrev Augusto Fraga Giachero :

> Hi,
>
> I've experienced crashes in pcbnew when creating a cooper fill zone when
> no board edges has been defined. Tuns out that BuildBoardPolygonOutlines
> is called with aErrorText set to nullptr an it tries to deference it to
> write an error message when no board edges has been found.
>
> The attached patch checks aErrorText and only deference it if it is not
> nullptr.
>
> Upon further investigation I discovered that the overloaded method
> BOARD::GetBoardPolygonOutlines is called from ZONE_FILLER::Fill with its
> default values of aErrorText and aErrorLocation (both nullptr). Wouldn't
> be better to supply a valid pointer to aErrorText to inform the user
> about the error / warning in this case?
>
> Thanks,
> Augusto.
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] Segmentation Fault when creating a copper zone

2020-08-21 Thread Augusto Fraga Giachero
Hi,

I've experienced crashes in pcbnew when creating a cooper fill zone when
no board edges has been defined. Tuns out that BuildBoardPolygonOutlines
is called with aErrorText set to nullptr an it tries to deference it to
write an error message when no board edges has been found.

The attached patch checks aErrorText and only deference it if it is not
nullptr.

Upon further investigation I discovered that the overloaded method
BOARD::GetBoardPolygonOutlines is called from ZONE_FILLER::Fill with its
default values of aErrorText and aErrorLocation (both nullptr). Wouldn't
be better to supply a valid pointer to aErrorText to inform the user
about the error / warning in this case?

Thanks,
Augusto.
>From f14e9a171d3e7e023b7778745c3b29f7119e9603 Mon Sep 17 00:00:00 2001
From: Augusto Fraga Giachero 
Date: Fri, 21 Aug 2020 08:36:17 -0300
Subject: [PATCH] Check the aErrortext pointer before deferencing it

BuildBoardPolygonOutlines can be called with aErrorText set to
nullptr (as it is when calling BOARD::GetBoardPolygonOutlines with its
default values).
---
 pcbnew/convert_drawsegment_list_to_polygon.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pcbnew/convert_drawsegment_list_to_polygon.cpp b/pcbnew/convert_drawsegment_list_to_polygon.cpp
index aaf04b211..bd962f74a 100644
--- a/pcbnew/convert_drawsegment_list_to_polygon.cpp
+++ b/pcbnew/convert_drawsegment_list_to_polygon.cpp
@@ -785,7 +785,8 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, wxStri
 }
 else
 {
-*aErrorText = _( "No edges found on Edge.Cuts layer." );
+if( aErrorText != nullptr )
+*aErrorText = _( "No edges found on Edge.Cuts layer." );
 }
 
 if( !success || !aOutlines.OutlineCount() )
-- 
2.28.0

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp