Skip to content

Commit

Permalink
Fix bug in Sanitize() where string length was not calculated correctl…
Browse files Browse the repository at this point in the history
…y causing R to intermittently crash. Fixes Issue 16.
  • Loading branch information
cameronbracken committed Oct 14, 2010
1 parent e44bfa3 commit 8b354e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tikzDevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ static char *Sanitize(const char *str){

//This is really stupid but create a copy of cleanString to
// avoid warning: "discards qualifiers from pointer target type"
char *cleanStringCP = (char *) calloc( strlen(cleanString), sizeof(char) );
char *cleanStringCP = (char *) calloc( strlen(cleanString) + 1, sizeof(char) );

strcat(cleanStringCP, cleanString);

Expand Down

7 comments on commit 8b354e0

@mlt
Copy link

@mlt mlt commented on 8b354e0 Oct 15, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... I dunno R internals, tikzDevice details, and I don't like old plain C, but isn't strdup() does the same? I'm just curious.

@cameronbracken
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, yeah it does. Figures there would be an easy way to do it. Shows how much I know about C. ;)

@mlt
Copy link

@mlt mlt commented on 8b354e0 Oct 15, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who cares as long as it works now :-)

@cameronbracken
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amen

@Sharpie
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed! Thanks for taking the time to file bug reports Mikhail!

@mlt
Copy link

@mlt mlt commented on 8b354e0 Oct 16, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are welcome! We all are interested in a quality end product:-) I'm really excited about pgfSweave & tikzDevice! Thank you for making these great packages!

Offtopic Q: I remember I saw highlight package, but it works as a driver for plain Sweave. Any plans to have syntax highlighting with pgfSweave?

@cameronbracken
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah really, thanks for the interest and the comments, it keeps us motivated.

Yeah actually the most recent development of pgfSweave includes highlighted code from the highlight package. It is in testing and development and there seems to be a few issues but I have used it myself for some time without any major problems.

http://github.com/cameronbracken/pgfSweave/tree/highlight

Please sign in to comment.