segmentation fault

hi all,

i am having a segmentation fault while calling a class function.
can you please advise me where i do wrong.

thank you in advance.

class function:
int IstcmsUtil::generateCvv(OC_Map_Type &inparams, char *cvv)

program call:
istcmsApp->istcmsUtil->generateCvv(cparams, gcvv);

debug core:
/development/bin>dbx embutil core

Segmentation fault in emb_fmtembfile(long) at line 635 in file "/development/src/embutil.cxx" ($t1)
635 istcmsApp->istcmsUtil->generateCvv(cparams, gcvv);
(dbx)
We can't help much unless we see line 635, and preferably also any code related to it.

-Albatross
Without knowing your program intimately, there's no way to know for sure what caused it. Every time you freed memory or you dereferenced a pointer, there's a chance memory got corrupted. Start looking at the place where the segfault occurred, check your pointers and parameters for validity, then move outwards.
Last edited on
hi Albatross,

part of my program code:

OC_Map_Type cparams;
OCString inst;
char gcvv[CMS_CVV_LEN + 1];

cparams[CMS_PAN] = OCString(vpan);
cparams[CMS_INSTITUTION] = OCString(vinst_id);
cparams[CMS_LANG] = OCString(istcmsApp->istcmsUtil->getInstParam(inst, "istcms.default_lang"));
cparams[CMS_LANG] = OCString(vdefault_lang_code);
cparams[CMS_ICC_INDICATOR] = OCString(vicc_indicator);
cparams[CMS_CARD_CATEGORY] = OCString(vcard_category);
cparams[CMS_REGION_CODE] = OCString(vregion);
cparams[CMS_EXP_DATE] = OCString(vexpirydate);
cparams[CMS_SERVICE_CODE] = OCString(vservice_code);

printf("aft OTraceDebug\n");
istcmsApp->istcmsUtil->generateCvv(cparams, gcvv); --- line 635
printf("aft generateCvv\n");
strncpy (&pebf->eb.track2.cvv[0], &gcvv[0], 3);
printf("aft eb.track2.cvv\n");

part of the class function code:

int IstcmsUtil::generateCvv(OC_Map_Type &inparams, char *cvv)
{
PINVERPARM *pinparm;

char prefix[11], base[11], addon_seq[5], reiss_seq[5], card_seq[5];
char branch[5], track2[120] = {0};
int ret = 0;

char *instid = (char *) inparams[CMS_INSTITUTION];
char *pan = (char *) inparams[CMS_PAN];
I guess istcmsApp or istcmsUtil don't point to the right adress. You could ask the debugger of your choice which one of them. Seeing more code, I might be able to tell you more.
hi JoR

you are right! istcmsApp don't point to the right address.
thank you very much.

i did a printf to find it out.
printf("%x %x\n", istcmsApp , istcmsApp->istcmsUtil )
Topic archived. No new replies allowed.