Program: 31382
Project: 31382
Buggy source:
public InterceptingHTTPServletRequest(HttpServletRequest request) throws UploadTooLargeException, FileUploadException, IOException {
  super(request);
  allParameters=new Vector<Parameter>();
  allParameterNames=new Vector<String>();
  Enumeration e=request.getParameterNames();
  while (e.hasMoreElements()) {
    String param=(String)e.nextElement();
    allParameters.add(new Parameter(param,super.getParameter(param),false));
    allParameterNames.add(param);
  }
  boolean isMultipart=ServletFileUpload.isMultipartContent(request);
  if (isMultipart) {
    request.getInputStream().mark(0);
    ServletFileUpload sfu=new ServletFileUpload();
    FileItemIterator iter=sfu.getItemIterator(request);
    while (iter.hasNext()) {
      FileItemStream item=iter.next();
      String name=item.getFieldName();
      InputStream stream=item.openStream();
      if (item.isFormField()) {
        String value=Streams.asString(stream);
        allParameters.add(new Parameter(name,value,true));
        allParameterNames.add(name);
      }
 else {
        RandomAccessFile raf=new RandomAccessFile(File.createTempFile("String_Node_Str" + item.getFieldName(),"String_Node_Str"),"String_Node_Str");
        byte buffer[]=new byte[CHUNKED_BUFFER_SIZE];
        int size=0;
        int len=0;
        while (len != -1 && size <= AppGuardianConfiguration.MAX_FILE_SIZE) {
          len=stream.read(buffer,0,CHUNKED_BUFFER_SIZE);
          if (len != -1) {
            size+=len;
            raf.write(buffer,0,len);
          }
        }
        if (size > AppGuardianConfiguration.MAX_FILE_SIZE) {
          throw new UploadTooLargeException("String_Node_Str" + name);
        }
      }
    }
    request.getInputStream().reset();
  }
}

Fixed version (ground truth):
public InterceptingHTTPServletRequest(HttpServletRequest request) throws UploadTooLargeException, FileUploadException, IOException {
  super(request);
  allParameters=new Vector<Parameter>();
  allParameterNames=new Vector<String>();
  Enumeration e=request.getParameterNames();
  while (e.hasMoreElements()) {
    String param=(String)e.nextElement();
    allParameters.add(new Parameter(param,request.getParameter(param),false));
    allParameterNames.add(param);
  }
  boolean isMultipart=ServletFileUpload.isMultipartContent(request);
  if (isMultipart) {
    request.getInputStream().mark(0);
    ServletFileUpload sfu=new ServletFileUpload();
    FileItemIterator iter=sfu.getItemIterator(request);
    while (iter.hasNext()) {
      FileItemStream item=iter.next();
      String name=item.getFieldName();
      InputStream stream=item.openStream();
      if (item.isFormField()) {
        String value=Streams.asString(stream);
        allParameters.add(new Parameter(name,value,true));
        allParameterNames.add(name);
      }
 else {
        RandomAccessFile raf=new RandomAccessFile(File.createTempFile("String_Node_Str" + item.getFieldName(),"String_Node_Str"),"String_Node_Str");
        byte buffer[]=new byte[CHUNKED_BUFFER_SIZE];
        int size=0;
        int len=0;
        while (len != -1 && size <= AppGuardianConfiguration.MAX_FILE_SIZE) {
          len=stream.read(buffer,0,CHUNKED_BUFFER_SIZE);
          if (len != -1) {
            size+=len;
            raf.write(buffer,0,len);
          }
        }
        if (size > AppGuardianConfiguration.MAX_FILE_SIZE) {
          throw new UploadTooLargeException("String_Node_Str" + name);
        }
      }
    }
    request.getInputStream().reset();
  }
}