On Sun, 7 Jun 2015 08:30:09 -0700 (PDT), ghada glissa
<
ghada...@gmail.com> wrote:
>Hi all,
>
>I have a C++ program that I wrote. The code compiles without any error or warning message. But when I execute it, I get
>
>*** glibc detected ***: corrupted double-linked list: 0x000000000564d6f0 ***
>
>Source code:
>
>void Prog:: input_transfo(uint8_t al,uint8_t ml,uint8_t* aa, uint8_t* mm,
> uint8_t* Pl, uint8_t* Au){
>
> uint8_t s=0;
> uint8_t *ll=new uint8_t[10];
>
> input(al,s,ll);
What data, if any, does this function put in ll? Does it magically
change s?
> taille1 = adjust_length(s+al,16);
What is the value of al? What does the function do?
> uint8_t *Add=new uint8_t[taille1];
>
> memcpy(Add,ll,s);
What do you expect memcpy to do since s is 0?
> memcpy(Add+s,aa,al);
> memcpy(Pl,mm,ml);
>
> taille2 = adjust_length(ml,16);
What does this function do?
> memcpy(Au,Add,taille1);
> memcpy(Au+taille1,Pl,taille2);
>
>
> delete ll;
> delete AddAuthData;
What is AddAuthData? Do it point to allocated memory? Where do you
delete the memory allocated to Add?
> }
>
>void Prog:: auth(uint8_t authlen,uint8_t al,uint8_t ml,uint8_t *n,uint8_t*a,uint8_t *ms,uint8_t *k, uint8_t *MAC){
Parameters authlen, n, k, and MAC appear to be unused in the function?
> uint8_t *Pl=new uint8_t[taille2];
> uint8_t *Au=new uint8_t[taille1+taille2];
>
> input_transfo(al,ml,a,ms,Pl,Au);
>
>
> delete PlainData;
> delete AuData;
What are PlainData and AuData? Do they point to allocated memory?
Where do you delete the memory allocated to Pl and Au?
> }
>
>taille1 et taille2 are two globale variables
>I got this error when i use the second function which uses the first function.
>
>any help please??
Show us your real code, the type of each global variable, and the
values of both global variables and function arguments. Tell us what
the uncoded called functions do. Invest in a little horizontal white
space to make your code readable.
--
Remove del for email