Commits

BarryFSmith committed a41b6a6

increased static sizes in PetscBagRegisterEnum() and added error checking for when they go out of range

Hg-commit: db85936a335e488f8372414bebd56082989a348f

Comments (0)

Files changed (1)

src/sys/bag/f2003-src/fsrc/bagenum.F

       Type(C_Ptr),Dimension(:),Pointer :: CArray
       character(kind=c_char),pointer   :: nullc => null()
       PetscInt   :: i,Len
-      Character(kind=C_char,len=99),Dimension(:),Pointer::list1
+      Character(kind=C_char,len=256),Dimension(:),Pointer::list1
 
-      do i=1,100
+      do i=1,256
         if (len_trim(Farray(i)) .eq. 0) then
           Len = i-1
           goto 100
         endif
+        if (len_trim(Farray(i)) .gt. 255) then
+          ierr = PETSC_ERR_ARG_OUTOFRANGE 
+          return
+        endif
       enddo
+      ierr = PETSC_ERR_ARG_OUTOFRANGE 
+      return
+
  100  continue
 
       Allocate(list1(Len),stat=ierr);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.