You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int main(int argc, char *argv[])
{
printf("locale at program start %s\n", setlocale(LC_ALL, NULL));
mcc118_open(0); // calling before setlocale() works
mcc118_close(0);
// That's what gtk_init() is doing according
// to the documentation of gtk_disable_setlocale()
setlocale (LC_ALL, "");
printf("locale after setlocale() %s\n", setlocale (LC_ALL, NULL));
mcc118_open(0); // calling after setlocale() segfaults
mcc118_close(0);
return 0;
}
The 2nd call of mcc118_open() crashes.
I have built libdaqhats with -O0 to get better backtraces:
#0 0x76f82d14 in _parse_factory_data (root=0x0, data=0x22a08) at mcc118.c:689 #1 0x76f83a88 in mcc118_open (address=0 '\000') at mcc118.c:1143 #2 0x000106f8 in main (argc=1, argv=0x7effefe4) at test.c:17
Crash happens in line
if ((root->type != cJSON_Object) ||
because root is NULL.
The crash doesn't happen anymore if I do
export LC_ALL=C in the console.
I have built the example like this
gcc -Wall -O0 -g test.c -ldaqhats
My locale is de_DE.UTF-8
The text was updated successfully, but these errors were encountered:
The cJSON conversion of the EEPROM data is failing due to the locale changing to one that uses commas as the decimal point character. Adding -DENABLE_LOCALES=Off to the compile options fixes the issue, and I will do more checking on the returned pointer. This will be added to the next release.
Hi,
I have a crash when I call mcc118_open() after setlocale().
#include <daqhats/daqhats.h>
#include <locale.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("locale at program start %s\n", setlocale(LC_ALL, NULL));
}
The 2nd call of mcc118_open() crashes.
I have built libdaqhats with -O0 to get better backtraces:
#0 0x76f82d14 in _parse_factory_data (root=0x0, data=0x22a08) at mcc118.c:689
#1 0x76f83a88 in mcc118_open (address=0 '\000') at mcc118.c:1143
#2 0x000106f8 in main (argc=1, argv=0x7effefe4) at test.c:17
Crash happens in line
if ((root->type != cJSON_Object) ||
because root is NULL.
The crash doesn't happen anymore if I do
export LC_ALL=C in the console.
I have built the example like this
gcc -Wall -O0 -g test.c -ldaqhats
My locale is de_DE.UTF-8
The text was updated successfully, but these errors were encountered: