Dear Thomas,

The following code can crash the R session
> require(rcom)
Loading required package: rcom
Loading required package: rscproxy
> XL<-comGetObject("EXCEL.application")
> XL[["activecell"]][["value"]]
[1] NA
> XL[["activecell"]][["value"]]<-numeric(0)

Of course no one wants to set the property in this way, however it is
possible inside of a function (and this was the way I found this).
The cause of the problem is in the file util.c of the rcom package.

The code I found on CRAN is the next. See the two extra comment for the
specific location of the problem .

#if 1
/** create a VARIANT from an SEXP */
BOOL SEXP2Variant(SEXP sexp,VARIANT* variant)
{
  BDX_Data* lBdx = NULL;
  int lRc;

  assert (variant != NULL);
  /* create a BDX structure from the SEXP */
  /*  RCOM_TRACE(printf("SEXP2Variant: calling SEXP2BDX\n")); */
  lRc = SEXP2BDX(sexp,&lBdx);

  if(lRc != 0) {
    RCOM_TRACE(printf("conversion of SEXP to BDX failed with error %d\n",
                      lRc));
///////////////////////////////////////////////////////////////////
//here should be a return FALSE;
//////////////////////////////////////////////////////////////////
  }

  /* convert the BDX structure to VARIANT */
  /*  RCOM_TRACE(printf("SEXP2Variant: calling BDX2Variant\n")); */
  lRc = BDX2Variant(lBdx,variant);
///////////////////////////////////////////////////////////////////
// this call to BDX2Variant is the place of the crash.
//////////////////////////////////////////////////////////////////
  /*  RCOM_TRACE(printf("SEXP2Variant: calling bdx_free\n")); */
  bdx_free(lBdx);

  if(lRc == 0) {
    return TRUE;
  }
  RCOM_TRACE(printf("conversion from BDX to VARIANT failed with error %d\n",
                    lRc));
  return FALSE;
}

Best wishes
   Vilmos



-- 
Vilmos Prokaj
Eötvös Loránd University,
Department of Probability and Statistics
Pázmány Péter sétány 1/C
Budapest, 1117
Hungary

e-mail:[EMAIL PROTECTED]

_______________________________________________
Rcom-l mailing list
Rcom-l@mailman.csd.univie.ac.at
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
More information (including a Wiki) at http://rcom.univie.ac.at

Reply via email to