ESP32 - Stack smashing protect failure!

Hello friends.

I am using a ESP32 and playing a little bit around. I made a function, where i simply read values from my Nextion and store them into my EPROM. Unfortunately i get the above error. Not always but its kinda a 50/50 chance.

Here is the code of the function, that reads the values from my Nextion:

void buttonRegler_SavePopCallback(void *ptr)
{
  pageID_global = 24;
  uint32_t zweiPunkt_OnOff;
  uint32_t zweiPunkt_UpDown;
  char _zweiPunkt_Sollwert[7];
  char _zweiPunkt_Hysterese[7];
  char _zweiPunkt_Regelzeit[7];
  char _zweiPunkt_Totzeit[7];
  char *end1;
  char *end2;

  float f_zweiPunkt_Sollwert;
  float f_zweiPunkt_Hysterese;
  int i_zweiPunkt_Regelzeit;
  int i_zweiPunkt_Totzeit;

  sw_twoPoint_OnOff.getValueDS(&zweiPunkt_OnOff);
  sw_TwoPoint_UpDown.getValueDS(&zweiPunkt_UpDown);

  t_Sollwert.getText(_zweiPunkt_Sollwert,7);
  t_Hysterese.getText(_zweiPunkt_Hysterese,7);
  t_Regelzeit.getText(_zweiPunkt_Regelzeit,7);
  t_Totzeit.getText(_zweiPunkt_Totzeit,7);

  f_zweiPunkt_Sollwert = strtof(_zweiPunkt_Sollwert,&end1);
  f_zweiPunkt_Hysterese = strtof(_zweiPunkt_Hysterese,&end2);
  i_zweiPunkt_Regelzeit = atoi(_zweiPunkt_Regelzeit);
  i_zweiPunkt_Totzeit = atoi(_zweiPunkt_Totzeit);

  generalSettings._sw_twoPoint_OnOff = zweiPunkt_OnOff;
  generalSettings._sw_TwoPoint_UpDown = zweiPunkt_UpDown;
  generalSettings.zweipunkt_sollwert = f_zweiPunkt_Sollwert;
  generalSettings.zweipunkt_hyst = f_zweiPunkt_Hysterese;
  generalSettings.zweipunkt_regelzeit = i_zweiPunkt_Regelzeit;
  generalSettings.zweipunkt_totzeit = i_zweiPunkt_Totzeit;

  EEPROM.writeBool(PHVALUEADDR + 17*(sizeof(float)),generalSettings._sw_twoPoint_OnOff);
  EEPROM.commit();
  EEPROM.writeBool(PHVALUEADDR + 18*(sizeof(float)),generalSettings._sw_TwoPoint_UpDown);
  EEPROM.commit();
  EEPROM.writeFloat(PHVALUEADDR + 19*(sizeof(float)), generalSettings.zweipunkt_sollwert);
  EEPROM.commit();
  EEPROM.writeFloat(PHVALUEADDR + 20*(sizeof(float)), generalSettings.zweipunkt_hyst);
  EEPROM.commit();
  EEPROM.writeInt(PHVALUEADDR + 21*(sizeof(float)),generalSettings.zweipunkt_regelzeit);
  EEPROM.commit();
  EEPROM.writeInt(PHVALUEADDR + 22*(sizeof(float)), generalSettings.zweipunkt_totzeit);
  EEPROM.commit();

  String str4Nextion = String("Notification.")+String("t0")+String(".txt=")+String("\"")+String(popup.popuptxt_changessaved)+String("\"");
  Serial2.print(str4Nextion);
  Serial2.write(0xFF);
  Serial2.write(0xFF);
  Serial2.write(0xFF);
  Serial2.print("page Notification");Serial2.write(0xFF);Serial2.write(0xFF);Serial2.write(0xFF);
  }

What i have found out: When i comment the following out:

  generalSettings.zweipunkt_sollwert = f_zweiPunkt_Sollwert;
  generalSettings.zweipunkt_hyst = f_zweiPunkt_Hysterese;

the error disappears. I have no idea why this happens and what i am doing wrong

Anyone an idea? Thank you

Impossible to debug from the posted snippet. Stack smashing is usually related to buffer overflow, try to decode the exception and see what comes out.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.