[comp.lang.perl] input trashing bug in str.c

vinoski@apollo.HP.COM (Stephen Vinoski) (11/18/90)

Enclosed is an unofficial patch for a bug in str_gets() in str.c @ pl41.
The bug can cause input to be trashed.  As far as I can tell the bug has
been around for awhile; I've checked all patches back to pl29 and it
doesn't appear that any of them introduced it.

-steve


*** str.c.old	Fri Nov 16 20:23:48 1990
--- str.c	Sat Nov 17 12:32:11 1990
***************
*** 804,809 ****
--- 804,810 ----
  	    if (get_paragraph && oldbp)
  		obpx = oldbp - str->str_ptr;
  	    bpx = bp - str->str_ptr;	/* prepare for possible relocation */
+             str->str_cur = bpx;
  	    STR_GROW(str, str->str_len + append + cnt + 2);
  	    bp = str->str_ptr + bpx;	/* reconstitute our pointer */
  	    if (get_paragraph && oldbp)


| Steve Vinoski  (508)256-6600 x5904       | Internet: vinoski@apollo.hp.com  |
| Testability and Diagnostics              | UUCP: ...mit-eddie!apollo!vinoski|
| HP Apollo Division, Chelmsford, MA 01824 |       ...uw-beaver!apollo!vinoski|
|                             I feel crapulous today.                         |

vinoski@apollo.HP.COM (Stephen Vinoski) (11/19/90)

In article <4e10c201.20b6d@apollo.HP.COM> vinoski@apollo.HP.COM (that's me) writes:
>The bug can cause input to be trashed.  As far as I can tell the bug has
>been around for awhile; I've checked all patches back to pl29 and it
>doesn't appear that any of them introduced it.

I guess I didn't look very carefully.  The bug was introduced in patch 40.


-steve


| Steve Vinoski  (508)256-6600 x5904       | Internet: vinoski@apollo.hp.com  |
| Testability and Diagnostics              | UUCP: ...mit-eddie!apollo!vinoski|
| HP Apollo Division, Chelmsford, MA 01824 |       ...uw-beaver!apollo!vinoski|
|                             I feel crapulous today.                         |