Nicolas Schodet | 31 Aug 2011 00:41

Segmentation fault when pasting using 0.75.2

Hello,

I am using (well, trying to use for the moment) LeoCAD for Linux and I
have a problem since 0.75.2. Pasting can make the program crash.

How to reproduce:

 - start leocad,
 - insert a piece,
 - copy,
 - paste.

The problem seems to be located in project.cpp, line 4738, in the
Project::HandleCommand function, case LC_EDIT_PASTE. The name variable
is too small.

If you grep 'char.*\[9\]', you will find several other possible
occurrences of the same problem:

common/library.cpp:1156:                char TexName[9];
common/library.cpp:1251:        char* p, NewTexName[9];
common/library.cpp:1295:                char TexName[9];
common/library.h:148:   char name[9];
common/pieceinf.cpp:385:    char name[9];
common/project.cpp:525:                 char name[9];
common/project.cpp:1084:                                char name[9];
common/project.cpp:4738:                                char name[9];
common/texture.h:38:  char m_strName[9];
tools/convert/convert.c:38:     char name[9];
tools/convert/convert.c:47:char _strName[9];
(Continue reading)

Leonardo Zide | 31 Aug 2011 01:31
Picon

Re: Segmentation fault when pasting using 0.75.2


  Hello,

  Thanks for the bug report, I've checked in a fix for it. Don't forget to update your svn copy to point to the new server (svn.leocad.org) if you haven't done so in the last month or two.

  Even though I can see why it would crash pasting pieces it wasn't crashing for me but it should be working now, sorry for the trouble.

  I've also fixed the website permissions to allow creating tickets without being logged in.

Leonardo



On Tue, Aug 30, 2011 at 3:41 PM, Nicolas Schodet <nico-leocad-i7Qt1XeGwYdg9hUCZPvPmw@public.gmane.org> wrote:
Hello,

I am using (well, trying to use for the moment) LeoCAD for Linux and I
have a problem since 0.75.2. Pasting can make the program crash.

How to reproduce:

 - start leocad,
 - insert a piece,
 - copy,
 - paste.

The problem seems to be located in project.cpp, line 4738, in the
Project::HandleCommand function, case LC_EDIT_PASTE. The name variable
is too small.

If you grep 'char.*\[9\]', you will find several other possible
occurrences of the same problem:

common/library.cpp:1156:                char TexName[9];
common/library.cpp:1251:        char* p, NewTexName[9];
common/library.cpp:1295:                char TexName[9];
common/library.h:148:   char name[9];
common/pieceinf.cpp:385:    char name[9];
common/project.cpp:525:                 char name[9];
common/project.cpp:1084:                                char name[9];
common/project.cpp:4738:                                char name[9];
common/texture.h:38:  char m_strName[9];
tools/convert/convert.c:38:     char name[9];
tools/convert/convert.c:47:char _strName[9];
tools/convert/convert.c:65:     char tmp[9];
tools/convert/convert.c:1308:                   char buf[100], f1[9],
f2[9], *ptr, *ptr2;
tools/convert/texture.cpp:21:   char name[9];
tools/update/update.cpp:16:     char oldname[9];
tools/update/update.cpp:17:     char newname[9];
tools/update/update.cpp:22:    char name[9];
tools/update/update.cpp:281:    char buf[100], f1[9], f2[9], *ptr,
*ptr2;
win/Cadview.cpp:491:                    char dbuffer [9];
win/Cadview.cpp:500:                    char tbuffer [9];
win/Piecebar.cpp:833:           char ParentName[9];

I did not find any 'New ticket' on the trac page, so I post it here.

Thanks for LeoCAD!

Nicolas.
_______________________________________________
Leocad mailing list
Leocad-KBwQgg6FT4s/11+TDStg7g@public.gmane.org
https://list.gerf.org/listinfo/leocad

_______________________________________________
Leocad mailing list
Leocad@...
https://list.gerf.org/listinfo/leocad
Nicolas Schodet | 31 Aug 2011 09:20

Re: Segmentation fault when pasting using 0.75.2

* Leonardo Zide <leozide@...> [2011-08-30 16:31]:
>   Thanks for the bug report, I've checked in a fix for it. Don't forget to
> update your svn copy to point to the new server (svn.leocad.org) if you
> haven't done so in the last month or two.
>   Even though I can see why it would crash pasting pieces it wasn't crashing
> for me but it should be working now, sorry for the trouble.

Thanks, I will test it tonight. Actually, if I compiled without
optimisation, it did not crash, so this really depends on the compiler
work.

>   I've also fixed the website permissions to allow creating tickets without
> being logged in.

Sadly, there is spam yet! ;-(

Nicolas.
Leonardo Zide | 31 Aug 2011 20:54
Picon

Re: Segmentation fault when pasting using 0.75.2

On Wed, Aug 31, 2011 at 12:20 AM, Nicolas Schodet <nico-leocad-i7Qt1XeGwYdg9hUCZPvPmw@public.gmane.org> wrote:
>   I've also fixed the website permissions to allow creating tickets without
> being logged in.

Sadly, there is spam yet! ;-(

  Wow, that was fast. I deleted the spam and disabled anonymous tickets. :(

_______________________________________________
Leocad mailing list
Leocad@...
https://list.gerf.org/listinfo/leocad
Nicolas Schodet | 31 Aug 2011 22:49

Patches for linux version

Hello,

I would like to propose patches to leocad, most of them are about the
linux port. Can I send them to this list?

Also, I have some questions about the keyboard shortcut system. There
seems to be two differents systems, KeyboardShortcuts table which is not
used by the linux port, and OnKeyDown() which seems to be legacy. Could
you bring some light about this?

Thanks,

Nicolas.

Gmane