Re: DBD::Oracle 1.26 new_tablename / synonyms issue

John Scoles <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
I have applied this patch to trunk you can find it here

http://svn.perl.org/modules/dbd-oracle/trunk

It will be part of Release 1.28 sometime before the end of the month.

Cheers
John Scoles


On Tue, Nov 16, 2010 at 10:28 AM, Jan Pazdziora <[email protected]>wrote:

>
> Hello,
>
> The DBD::Oracle 1.26 code
>
>        http://cpansearch.perl.org/src/TIMB/DBD-Oracle-1.26/oci8.c
>
> declares
>
>        char new_tablename[100];
>
> in the if branch in init_lob_refetch, and then assigns
>
>        tablename=new_tablename;
>
> and then uses the tablename outside of that if block. So the
> tablename pointer points to a random address on the stack.
>
> It causes problems described at
>
>        http://rt.cpan.org/Public/Bug/Display.html?id=61511
>        https://bugzilla.redhat.com/show_bug.cgi?id=548489
>
> Note that it's kinda related to
>
>        http://rt.cpan.org/Public/Bug/Display.html?id=36069#txn-464638
>
> where it's said
>
>        Used some of the code form the patch there was no need to
>        create a char [100] outside the if statement though.
>
> I'd claim that it is actually necessary to declare it outside of
> that block because even if the name goes out of scope at the end
> of the block, the tablename pointer still points to it.
>
> Please apply
>
> --- oci8.c.orig 2010-11-16 16:26:42.459208675 +0100
> +++ oci8.c      2010-11-16 16:27:27.194207404 +0100
> @@ -4030,6 +4030,7 @@
>        ub2 numcols = 0;
>        imp_fbh_t *fbh;
>        int unmatched_params;
> +       char new_tablename[100];
>        I32 i,j;
>        char *p;
>        lob_refetch_t *lr = NULL;
> @@ -4067,7 +4068,6 @@
>        if (status == OCI_SUCCESS) { /* There is a synonym, get the schema
> */
>                char *syn_schema=NULL;
>                char syn_name[100];
> -               char new_tablename[100];
>                ub4  tn_len = 0, syn_schema_len = 0;
>
>                strncpy(syn_name,tablename,strlen(tablename));
>
> to DBD::Oracle.
>
> Thank you,
>
> --
> Jan Pazdziora
>

--
From the Pythian family to yours, Happy Holidays and all the best in 2011!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.