[Rd] (PR#11281) Bug in R 2.7 for over long lines
Soeren Sonnenburg
r-ml at nn7.de
Tue May 13 08:17:23 CEST 2008
On Mon, 2008-05-12 at 08:39 -0400, Duncan Murdoch wrote:
> On 5/10/2008 5:20 PM, bugreports at nn7.de wrote:
> > On Sat, 2008-05-10 at 11:19 +0100, Prof Brian Ripley wrote:
> >> You will see the current code is different, and your 'fix' is not needed=20
> >> nor applies in R-devel.
> >
> > would be nice...
> >
> >> You failed to provide an example to reproduce the alleged bug, but the=20
> >
> > well the bug was obvious, I told that I can trigger it and that the
> > proposed fix fixed it - no need to provide an example.
>
> But it would be helpful to provide an example, so that we can test the
> fix. As Brian told you, your fix was no good: it was not against the
> current code.
Well it was when I posted it 4 days after R 2.7.0 was released.
And the bug was very obvious, I mean look at this (quoting from my
original report):
char *LongLine = (char *) malloc(nc);
...
LongLine[nc] = '\0';
note that LongLine is only nc chars long, so the LongLine[nc]='\0' might
be an out of bounds write. the fix would be to do
char *LongLine = (char *) malloc(nc+1);
Anyway an example that will crash R 2.7.0 is here
http://nn7.de/debugging/Features.R .
> >> issue does seem to be using lines beyond the documented line length.
> >
> > exactly. one can crash R with too long lines.
>
> Then the bug is also in your code, for sending lines that are too long.
> R shouldn't crash on user error, but "don't do that" is an appropriate
> response.
I would just like to see this bug in R fixed.
> >> So it would have only affected people who did that ....
> >
> > or use auto-generated code like e.g. swig produces.
>
> Then swig should be modified to produce valid code.
Sure. That's what I am trying to achieve.
[...]
> > I don't intend to play with devel versions of R, I was just trying to
> > get swig for R2.7 to work. Sorry that it triggered a bug in R. =EF=BB=BFI w=
> > ill
> > try R2.7.1 when it is released and report back.
>
> If you aren't interested in being helpful by testing fixes for your
> code, then I doubt if any of us are going to go out of our way to help
> you with your errors.
I still don't understand what I could have possibly done wrong
in my initial
post (http://article.gmane.org/gmane.comp.lang.r.devel/16243/)
to cause this meta-discussion.
But to put things in the right light. There is no bug in my code (this
time). But in R. And I did not ask for help - to the contrary: I've
pointed out a trivial to fix bug in R 2.7.0 and showed how it could be
fixed.
The problem is that I am not really an R user, but just wanted to
support the R community by porting shogun to R in the hope that it may
be useful for some. To achieve this I am fixing bugs in the R swig
interface generator and now also R. So the detour I am taking here is
massive and I have not received any help (except from Dirk so far).
So if possible lets stay focused on the bug: Dirk helped me to get the R
from svn-trunk (it says R 2.8 at startup) to compile and voila, sourcing
the code from above does not generate any crashes anymore. So the
rewrite of gram.c fixes it I guess.
Soeren
More information about the R-devel
mailing list