Merge commit 'origin/5.2' 67/167/1
Pierre MARECHAL [Tue, 20 Apr 2010 07:49:01 +0000 (09:49 +0200)]
Conflicts:
scilab/modules/matio/sci_gateway/c/sci_matfile_varreadnext.c

Change-Id: I2baffdab5b8100dde645c111804d9453ed018906

14 files changed:
1  2 
scilab/CHANGES_5.2.X
scilab/modules/atoms/macros/atomsAutoloadAdd.sci
scilab/modules/atoms/macros/atomsIsInstalled.sci
scilab/modules/atoms/macros/atomsRepositoryAdd.sci
scilab/modules/atoms/macros/atoms_internals/atomsDESCRIPTIONread.sci
scilab/modules/atoms/macros/atoms_internals/atomsExtract.sci
scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledPath.sci
scilab/modules/jvm/Makefile.in
scilab/modules/jvm/jvm.iss
scilab/modules/matio/sci_gateway/c/sci_matfile_varreadnext.c
scilab/modules/matio/src/c/matfile_manager.c
scilab/modules/scicos_blocks/macros/Misc/DIFF_f.sci
scilab/modules/scicos_blocks/macros/Sources/FROMWSB.sci
scilab/modules/scicos_blocks/macros/Sources/FROMWS_c.sci

Simple merge
Simple merge
Simple merge
@@@ -64,10 -58,16 +64,16 @@@ int sci_matfile_varreadnext(char *fname
        Scierror(999, _("%s: Wrong type for first input argument: Double expected.\n"), fname);
        return FALSE;
      }
 -
 +  
    /* Gets the corresponding matfile */
    matfile_manager(MATFILEMANAGER_GETFILE, &fileIndex, &matfile);
-   
+   if (matfile == NULL)
+     {
+       Scierror(999, _("%s: Invalid file identifier.\n"), fname);
+       return FALSE;
+     }
    matvar = Mat_VarReadNext(matfile);
    if ((matvar == NULL) || (matvar->name == NULL))
      {
@@@ -30,10 -29,10 +30,10 @@@ static int numberOfMatfiles = 0
  void matfile_manager(int action, int *fileIndex, mat_t **matfile)
  {
    int K = 0; /* Loop index */
 -
 -  if(action == MATFILEMANAGER_GETFILE) /* Get the mat_t structure corresponding to the fileIndex (fileIndex is an input) */
 +  
 +  if (action == MATFILEMANAGER_GETFILE) /* Get the mat_t structure corresponding to the fileIndex (fileIndex is an input) */
      {
-       if(*fileIndex>=numberOfMatfiles) /* FileIndex is too big */
+       if((*fileIndex >= numberOfMatfiles) || (*fileIndex < 0)) /* FileIndex is too big or invalid */
          {
            *matfile = NULL; /* Return NULL */
          }