Invalid fastbin entry

Anyone can help me with this error Message?


The program raises a runtime error

*** glibc detected *** ./prog: invalid fastbin entry (free): 0x085bb048 ***
======= Backtrace: =========
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:03 6301981 /home/w51clB/prog
0804a000-0804b000 rw-p 00001000 08:03 6301981 /home/w51clB/prog
085bb000-085dc000 rw-p 00000000 00:00 0 [heap]
b7300000-b7321000 rw-p 00000000 00:00 0
b7321000-b7400000 ---p 00000000 00:00 0
b745a000-b745c000 rw-p 00000000 00:00 0
b745c000-b75b2000 r-xp 00000000 08:03 7014801 /lib/i386-linux-gnu/i686/cmov/
b75b2000-b75b3000 ---p 00156000 08:03 7014801 /lib/i386-linux-gnu/i686/cmov/
b75b3000-b75b5000 r--p 00156000 08:03 7014801 /lib/i386-linux-gnu/i686/cmov/
b75b5000-b75b6000 rw-p 00158000 08:03 7014801 /lib/i386-linux-gnu/i686/cmov/
b75b6000-b75b9000 rw-p 00000000 00:00 0
b75b9000-b75d5000 r-xp 00000000 08:03 6998923 /lib/i386-linux-gnu/
b75d5000-b75d6000 rw-p 0001b000 08:03 6998923 /lib/i386-linux-gnu/
b75d6000-b75d7000 rw-p 00000000 00:00 0
b75d7000-b75fb000 r-xp 00000000 08:03 7014829 /lib/i386-linux-gnu/i686/cmov/
b75fb000-b75fc000 r--p 00023000 08:03 7014829 /lib/i386-linux-gnu/i686/cmov/
b75fc000-b75fd000 rw-p 00024000 08:03 7014829 /lib/i386-linux-gnu/i686/cmov/
b75fd000-b76dd000 r-xp 00000000 08:03 7537416 /usr/lib/i386-linux-gnu/
b76dd000-b76e1000 r--p 000e0000 08:03 7537416 /usr/lib/i386-linux-gnu/
b76e1000-b76e2000 rw-p 000e4000 08:03 7537416 /usr/lib/i386-linux-gnu/
b76e2000-b76e9000 rw-p 00000000 00:00 0
b76eb000-b76ef000 rw-p 00000000 00:00 0
b76ef000-b76f0000 r-xp 00000000 00:00 0 [vdso]
b76f0000-b770c000 r-xp 00000000 08:03 6998900 /lib/i386-linux-gnu/
b770c000-b770d000 r--p 0001b000 08:03 6998900 /lib/i386-linux-gnu/
b770d000-b770e000 rw-p 0001c000 08:03 6998900 /lib/i386-linux-gnu/
bfc0e000-bfc23000 rw-p 00000000 00:00 0 [stack]
your program has crashed. You would be better if you try to debug the code.
or you can post your code and we can help.
Yes, of course. I try to do an exercise proposed by the book, which I'm learning C + +, as an autodidact. I thank you for your cooperation

#include <iostream>

#include <string>

#include <math.h>

using namespace std;

int main() {

string const vocali="aeiou";

string const consonanti="bcdfghjklmnpqrstvwxyz";

string cognome;

cout << "inserisci il cognome " <<'\n';


int s=cognome.length();

int z=0;

int t=0;

string cons_cogn;

string voc_cogn;

string cod_fisc_cogn;

for (int i=0;i<s+1;i++)


string k="0";


if (k[i]>0)










if (cons_cogn.length()>2)



cout << cod_fisc_cogn <<'\n';




I see some issues as you are trying to put a number in string. you are trying to put things at invalid index in string.

What exactly you are trying to do in this code ?
Last edited on

I try to perform an automatic calculation of the tax code. Cognome = Surname. but the program is regularly compiled. Do you think it is appropriate to use an array instead of strings?
I try to do a check of the individual characters within the string through a loop. in practice if in the control cycle, the character is a consonant, assigns the character string to "cod_fisc_cogn." I do the exercise with the only tools available to this point in the book.

(Google translate)

Last edited on

hello. I understood what you wanted to tell me and I noticed that I had put k [i], which did not help. I have improved things and now it is ok. thank you again. P.S. I count on your help. not disappear :)

This is off-topic, but I don't get it. How come some issues get answered immediately and others like mine don't get one reply? O_o
hmmm... when your string is empty you cannot access some index >=0. For the kind of thing, you can use string::reserve. This will keep space reserved for you and you can use index in the string even if its empty.

Rest I think you must have found the issues. good luck.

@Patriot524 - I replied to your other post.
Topic archived. No new replies allowed.