PDL-Graphics-PLplot https://rt.cpan.org/Public/Bug/Display.html?id=104424 calls plschr() before plinit() in PLD::Graphics::PLplot::new().
This used to work until upgrading PLplot to 5.11.0. 5.11.0 crashed in the plschr().
May I know if it's legal or if plinit() has to be called before any other PLplot functions?
This C code reproduce the crash:
#include <stdlib.h> #include <plplot.h> int main( int argc, const char *argv[] ) { plschr( 0.0, 1.0); plinit(); plend(); exit( 0 ); }
I confirmed the issue by making the temporary change of calling plschr( 0.0, 1.0) before plinit() in examples/c/x00c.c. The result segfaulted and valgrind diagnosed the problem as an invalid read. I fixed the problem (commit id = 1424994) on our git master branch which will be basis for our forthcoming 5.11.1 release.
Note, the fix produces a valgrind-clean result for the modified x00c.c which is a useful fix because some of our users will try this use case (attempting to change the character size before the device is defined and initialized) leading to segfaults without the fix. However, I should emphasize this use case is not valid. For example, I have shown that calling plschr(0.0, 2.0) before plinit for the present fixed code has no effect on character sizes while making that call after plinit does affect character sizes. So essentially this bug fix just provides a much softer landing for this invalid use case.
Last edit: Alan W. Irwin 2015-05-18