bugGNU TeXmacs - Bugs: bug #29261, one-liner crashes texmacs

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #29261: one-liner crashes texmacs

Submitted by:  Matthias Berndt <matthias>
Submitted on:  Fri 19 Mar 2010 01:29:01 AM UTC  
 
Category: EditorPriority: 5 - Normal
Item Group: ErrorStatus: Fixed
Privacy: PublicAssigned to: Joris van der Hoeven <vdhoeven>
Originator Name: Open/Closed: Closed
Release: 1.0.7.14Release: None
Fixed Release: NoneFixed Release: 
Keywords: 

(Jump to the original submission Jump to the original submission)

Thu 15 Mar 2012 04:18:45 PM UTC, comment #10:

My example is now typeset as:
<error|arg var>
with "error" in red

the original example is typeset as:
arg var

looking like normal text. I suppose that is not ideal

Sam Liddicott <samjam>
Project Member
Thu 15 Mar 2012 03:27:16 PM UTC, comment #9:

Joris,
maybe you could add a small remark in the docs as to avoid these problems to future users?

Massimiliano Gubinelli <mgubi>
Project Administrator
Thu 15 Mar 2012 03:16:07 PM UTC, comment #8:

OK, I added some safety checks.

As to your second example

<assign|yuck|<xmacro|var|<arg|var|<arg|var|1>>>>
<yuck|1|2|3>

This code won't work because during the expansion of var, the variable var is no longer defined (i.e. a scoping problem). This is necessary for appropriate functioning of the macro system, so I will not change this. You may indeed use quasi/unquote here.

Joris van der Hoeven <vdhoeven>
Project AdministratorIn charge of this item.
Thu 15 Mar 2012 09:36:18 AM UTC, comment #7:

I strongly disagree with the analysis that the situation is analagous to doing:

void yuck () { yuck (); }

This one-liner works fine:

<with|yuck|<xmacro|var|<arg|var|1>>|<yuck|1|2|3>>

but this one crashes:

<with|yuck|<xmacro|var|<arg|var|foo>>|<yuck|1|2|3>>

What is it about changing "1" to "foo" that makes it analagous to
void yuck () { yuck (); }
?

So while I agree that there should be safeguards to protect against data loss from near-infinite recursion in the macros or scheme code, that is not the problem here.

I think this needs re-opening and re-analysing.

To demonstrate further, this does not crash:
<assign|yuck|<xmacro|var|<arg|var|0>>>
<yuck|1|2|3>

But this does

<assign|yuck|<xmacro|var|<arg|var|<arg|var|1>>>>
<yuck|1|2|3>

and this does not:
<assign|yuck|<xmacro|var|<quasi|<arg|var|<unquote|<arg|var|0>>>>>>
<yuck|1|2|3>

Why is quasi required to stop the crash?

I think there is a problem with <arg|...|...>

Sam Liddicott <samjam>
Project Member
Fri 09 Mar 2012 08:57:23 PM UTC, comment #6:

I agree with the security and data loss issues raised by Matthias. Some sort of safeguard mechanism should be present. This should be reopened.

Miguel de Benito <mdbenito>
Project Member
Fri 09 Mar 2012 08:51:02 PM UTC, comment #5:

I don't see that the one-liner is even recursive.

Sam Liddicott <samjam>
Project Member
Fri 09 Mar 2012 08:43:45 PM UTC, comment #4:

Hi,

I disagree with your assessment that this is "not really a bug". Every programming language interpreter today catches this, for example when I tell guile to evaluate this
(letrec ((f (lambda () (+ 1 (f))))) (f))
It'll tell me:
ERROR: Stack overflow. It won't simply crash. I'd expect a similar message from TeXmacs.

Note that this behaviour may well be security sensitive (code execution flaws based on stack overflows are far from unheard of). It can also lead to data loss when somebody opens such a broken document while editing another document which wasn't saved yet.

Matthias Berndt <matthias>
Fri 09 Mar 2012 08:23:13 PM UTC, comment #3:

This is not really a bug, since the situation is really
analoguous to doing

void yuck () { yuck (); }

Don't be surprised by a crash when writing this kind of code!

Joris van der Hoeven <vdhoeven>
Project AdministratorIn charge of this item.
Fri 09 Mar 2012 01:55:46 PM UTC, comment #2:

Assigned to Joris to make him aware. After the crash the call stack is huge (10000 frames): bridge_argument_rep::my_typeset and bridge_rep::typeset are calling each other in a loop.

Miguel de Benito <mdbenito>
Project Member
Thu 08 Mar 2012 11:03:46 PM UTC, comment #1:

This bug is still present in 1.0.7.14.

Massimiliano Gubinelli <mgubi>
Project Administrator
Fri 19 Mar 2010 01:29:01 AM UTC, original submission:

Hi,

when i paste this line into a new texmacs document, texmacs crashes:
<with|yuck|<xmacro|var|<arg|var|foo>>|<yuck|1|2|3>>

Regards
Matthias

Matthias Berndt <matthias>

 

Attached Files
file #19979:  test.tm added by matthias (197B - text/texmacs)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by samjam (Posted a comment)
  • -unavailable- added by vdhoeven (Posted a comment)
  • -unavailable- added by mdbenito (Posted a comment)
  • -unavailable- added by mgubi (Posted a comment)
  • -unavailable- added by samjam
  • -unavailable- added by matthias (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 15 Mar 2012 03:16:07 PM UTCvdhoevenStatusWont Fix=>Fixed
    Fri 09 Mar 2012 08:23:13 PM UTCvdhoevenStatusConfirmed=>Wont Fix
      Open/ClosedAccepted=>Closed
    Fri 09 Mar 2012 01:55:46 PM UTCmdbenitoAssigned toNone=>vdhoeven
      Open/ClosedOpen=>Accepted
      Release1.0.7.3=>1.0.7.14
    Thu 08 Mar 2012 11:03:46 PM UTCmgubiCategoryNone=>Editor
      StatusNone=>Confirmed
    Wed 18 Aug 2010 09:23:54 AM UTCsamjamCarbon-Copy-=>Added samjam
    Fri 19 Mar 2010 01:29:01 AM UTCmatthiasAttached File-=>Added test.tm, #19979

    Back to the top


    Powered by Savane 3.1-cleanup1