Skip to content
Snippets Groups Projects
Commit 900efe5e authored by Administrator's avatar Administrator Committed by Pierre-Alain Loizeau
Browse files

Fix crashing test on several Debian based CI runners

The crash happens due to a undersized char array where one writes after the
upper bound when the file path is to long. The problem occurred in the CI
pipeline for some users with very long user names.

The quick fix is to enlarge the charcter arrays but on the long term the char
arrays should be replaced by strings.
parent 5a41ae2e
No related branches found
No related tags found
1 merge request!1473Fix crashing test on several Debian based CI runners
Pipeline #25345 passed
...@@ -24,7 +24,7 @@ typedef struct MAT_VOL mat_vol_t; ...@@ -24,7 +24,7 @@ typedef struct MAT_VOL mat_vol_t;
struct MAT_VOL { struct MAT_VOL {
int count; // Number of volumes int count; // Number of volumes
char name[100]; char name[200];
}; };
int REG_MATERIALS = 0; // counter for the currently number of registered materials. int REG_MATERIALS = 0; // counter for the currently number of registered materials.
...@@ -65,7 +65,7 @@ int extract_mat_vol(char* fileName, mat_vol_t* material_array) ...@@ -65,7 +65,7 @@ int extract_mat_vol(char* fileName, mat_vol_t* material_array)
file.GetListOfKeys()->Print(); file.GetListOfKeys()->Print();
file.GetSize(); file.GetSize();
char geo_tag[100]; char geo_tag[300];
strcpy(geo_tag, fileName); strcpy(geo_tag, fileName);
char* ptr = strstr(geo_tag, ".geo.root"); char* ptr = strstr(geo_tag, ".geo.root");
*(ptr) = '\0'; *(ptr) = '\0';
...@@ -159,7 +159,7 @@ int examine_materials(const char* setup = "sis100_electron") ...@@ -159,7 +159,7 @@ int examine_materials(const char* setup = "sis100_electron")
printf("\n"); printf("\n");
TString fileName; TString fileName;
char fileNameC[100]; char fileNameC[300];
CbmSetup* cs = run.GetSetup(); CbmSetup* cs = run.GetSetup();
mat_vol_t* detector_materials = (mat_vol_t*) malloc(sizeof(mat_vol_t) * 500); mat_vol_t* detector_materials = (mat_vol_t*) malloc(sizeof(mat_vol_t) * 500);
for (int i = 0; i < MAX_MATERIALS; i++) { for (int i = 0; i < MAX_MATERIALS; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment