diff mbox

bc segfaults when using math library, and patch

Message ID 55776F11.3080803@gmail.com
State Changes Requested
Headers show

Commit Message

grepper June 9, 2015, 10:56 p.m. UTC
I have attached a patch that fixes the segfault in bc when it is used
with the math library loaded. A developer on #buildroot also commented
that perhaps buildroot should use the alpha version of bc like many
distros instead - I can't comment on that.

regards,
Robert

Comments

Peter Korsgaard June 10, 2015, 2:17 p.m. UTC | #1
>>>>> "grepper" == grepper  <grepper@gmail.com> writes:

 > I have attached a patch that fixes the segfault in bc when it is used
 > with the math library loaded. A developer on #buildroot also commented
 > that perhaps buildroot should use the alpha version of bc like many
 > distros instead - I can't comment on that.

I was going to ask if this is already upstream and if you had a
reference to the upstream version control, but GNU bc doesn't seem to
have any public vcs (or any real activity).

I see the latest alpha release is from 2006, and that one does make
save_adr static and NEWS contains the following note:

Bug fixes:
        fixes bug in load_code introduced by mathlib string storage in 1.06.


I personally don't use bc, but if people (and other distributions) think
the 1.06.95 alpha version is better then lets use it.

A quick look at the Debian package shows that they are carrying some
patches that might be interesting, E.G. 03_array_initialize.diff seems
like a clear bugfix:

https://packages.debian.org/jessie/bc

Care to send a patch to bump the version with this info?
diff mbox

Patch

load.c fix segfault when using bc with math library loaded

date: 2015-06-09
signed-off-by Robert Sohn <grepper@gmail.com>

--- bc-1.06/bc/load.c.orig	2015-06-09 18:32:45.308353614 -0400
+++ bc-1.06/bc/load.c	2015-06-09 18:31:44.120350947 -0400
@@ -156,7 +156,7 @@ 
   long  label_no;
   long  vaf_name;	/* variable, array or function number. */
   long  func;
-  program_counter save_adr;
+  static program_counter save_adr;
 
   /* Initialize. */
   str = code;