Thanks for your patches. They've been applied and pushed to origin/master. They will be included in the next released version of flex. (which I am planning on doing this weekend.)
On Thursday, 6 August 2015, 12:37 pm +0300, Jaska Uimonen <jas...@he...> wrote:
> Hello,
>
> I was assigned a task to fix some static analysis issues
> in certain sw components. There we're couple of issues found
> in flex.
>
> I have to say that I'm not totally sure these are real bugs
> and will ever manifest themselves. Some functions in flex
> are really long and it is really difficult to follow if the
> issues are false positives or not. OTH I don't think the
> fixes will do any harm either...
>
> First patch is just initializing an array, because the
> analysis says it might be used uninitialized (some 500
> lines later). I'm not sure it is a correct either to
> use the array initialized to 0 i.e. should the code exit
> earlier with an error if the array is not populated.
> Anyway this silences the warnings.
>
> Second patch is about not freeing yynultrans_tbl in some
> case. Again the function is really long so I have a little
> bit of trouble following the code flow.
>
> If there are issues with the patches or they are considered
> "non-issues", please let me know.
>
> br,
> Jaska Uimonen
>
>
>
> >From 69e1c063e830f91cac4001ed8d0d264de539c03c Mon Sep 17 00:00:00 2001
> From: Jaska Uimonen <jas...@he...>
> Date: Mon, 27 Jul 2015 10:59:58 +0300
> Subject: [PATCH 1/2] fix possible uninitialized array values
>
> ---
> src/dfa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/dfa.c b/src/dfa.c
> index c16a010..0a68e3a 100644
> --- a/src/dfa.c
> +++ b/src/dfa.c
> @@ -400,7 +400,7 @@ void ntod ()
> * from 1 to CSIZE, so their size must be CSIZE + 1.
> */
> int duplist[CSIZE + 1], state[CSIZE + 1];
> - int targfreq[CSIZE + 1], targstate[CSIZE + 1];
> + int targfreq[CSIZE + 1] = {0}, targstate[CSIZE + 1];
>
> /* accset needs to be large enough to hold all of the rules present
> * in the input, *plus* their YY_TRAILING_HEAD_MASK variants.
> --
> 1.9.3
>
> >From 0c897db0dab3bca5f96d4c4fb1f6f20ed1024c0c Mon Sep 17 00:00:00 2001
> From: Jaska Uimonen <jas...@he...>
> Date: Mon, 27 Jul 2015 11:20:05 +0300
> Subject: [PATCH 2/2] fix possible resource leak with yynultrans_tbl
>
> ---
> src/gen.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/gen.c b/src/gen.c
> index 049cbfe..81e7c27 100644
> --- a/src/gen.c
> +++ b/src/gen.c
> @@ -1525,7 +1525,7 @@ void make_tables (void)
> {
> int i;
> int did_eof_rule = false;
> - struct yytbl_data *yynultrans_tbl;
> + struct yytbl_data *yynultrans_tbl = NULL;
>
>
> skelout (); /* %% [2.0] - break point in skel */
> @@ -1755,9 +1755,13 @@ void make_tables (void)
> 0)
> flexerror (_
> ("Could not write yynultrans_tbl"));
> + }
> +
> + if (yynultrans_tbl != NULL) {
> yytbl_data_destroy (yynultrans_tbl);
> yynultrans_tbl = NULL;
> - }
> + }
> +
> /* End generating yy_NUL_trans */
> }
>
> --
> 1.9.3
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Flex-devel mailing list
> Fle...@li...
> https://lists.sourceforge.net/lists/listinfo/flex-devel
|