Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#283 Segfault with wordwrapping symbols

Egmont Koblinger

Start up joe-3.7 with wordwrap enabled and other default settings. (Hand-compiled joe on a 64-bit Ubuntu Hardy.)

Type "- - - - - - - - - - - - - - - - " etc., that is, minus signs and spaces following each other.
Joe crashes at around the 90th column.
Notice the same crash if you disable wordwrap, type this pattern beyond 90 columns, and then request an explicit indentation (^K J).

The same bug occurs when for example copy-pasting an extremely long unix command line containing hundreds of options into joe, such as this text:
foobar --key1=value1 --key2=value2 --key3=value3 --key4=value4 --key5=value5 --key6=value6 --key7=value7 --key8=value8 --key9=value9 --key10=value10 --key11=value11 --key12=value12 --key13=value13 --key14=value14 --key15=value15 --key16=value16 --key17=value17 --key18=value18 --key19=value19 --key20=value20 --key21=value21 --key22=value22 --key23=value23 --key24=value24 --key25=value25 --key26=value26 --key27=value27 --key28=value28 --key29=value29 --key30=value30 --key31=value31 --key32=value32 --key33=value33 --key34=value34 --key35=value35 --key36=value36 --key37=value37 --key38=value38 --key39=value39 --key40=value40

The problem is in uformat.c, line numbers are according to version 3.7:
L359 allocates just enough bytes to contain the copy of the current line, plus terminating zero, but no more room
L363 stores the string length in x
L364-365 do nothing
L367-368 extend the string with another space character, and write the terminating zero byte to an offset that's beyond the end of the allocated area.

A quick-n-ugly workaround is to change the implementation of brs() in b.c to allocate size+2 bytes instead of size+1. Obviously mainstream would need a proper solution.


  • (edited: ugly patch removed; use the proper one)

    Last edit: Egmont Koblinger 2013-09-25
  • John J. Jordan
    John J. Jordan

    • status: open --> closed-duplicate
    • Group: --> v3.8
  • John J. Jordan
    John J. Jordan

    Duplicate of #269.