Re: ccscript3-1.0.9/modules/sort.cpp: some broken code

David Sugar <[email protected]> Fri, 25 Dec 2009 13:23:31 -0500
Newsgroups gmane.comp.gnu.ccscript.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------090406040900090806030401
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Yeah...we should not dereference things off sym until we make sure we
have valid (non-NULL) pointer ;)....

d binderman wrote:
> 
> Hello there,
> 
> I just had a look at the source code of ccscript3-1.0.9/modules/sort.cpp,
> around line 140
> 
>         Symbol *sym = mapSymbol(getOption(NULL));
>         size_t count = 0;
>         Array *a = (Array *)&sym->data;
>         char *base = sym->data + sizeof(Array);
>         size_t size = a->rec + 1;
> 
>         if(!sym)
>         {
>                 error("sort-missing-symbol");
>                 return true;
>         }
> 
> In assigning to base, sym is assumed to be non-NULL. Suggest new code
> 
>         Symbol *sym = mapSymbol(getOption(NULL));
> 
>         if(!sym)
>         {
>                 error("sort-missing-symbol");
>                 return true;
>         }
>         size_t count = 0;
>         Array *a = (Array *)&sym->data;
>         char *base = sym->data + sizeof(Array);
>         size_t size = a->rec + 1;
> 
> Regards
> 
> David Binderman
> 
>  		 	   		  
> _________________________________________________________________
> Got more than one Hotmail account? Save time by linking them together
>  http://clk.atdmt.com/UKM/go/186394591/direct/01/
> 
> _______________________________________________
> ccscript-devel mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/ccscript-devel

--------------090406040900090806030401
Content-Type: text/x-vcard; charset=utf-8;
 name="dyfet.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="dyfet.vcf"

begin:vcard
fn:David Sugar
n:Sugar;David
org:GNU Telephony
email;internet:[email protected]
tel;work:+1 609 465 5336
url:http://www.gnutelephony.org
version:2.1
end:vcard


--------------090406040900090806030401
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ccscript-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/ccscript-devel

--------------090406040900090806030401--