Language: Python
Label: safe
CWE: CWE-770 \u2014 Allocation of Resources Without Limits or Throttling
The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor.

Code:
    async def form(self) -> FormMultiDict:
        """Retrieve form data from the request. If the request is either a 'multipart/form-data' or an
        'application/x-www-form- urlencoded', return a FormMultiDict instance populated with the values sent in the
        request, otherwise, an empty instance.

        Returns:
            A FormMultiDict instance
        """
        if self._form is Empty:
            content_type, options = self.content_type
            if content_type == RequestEncodingType.MULTI_PART:
                self._form = self.scope["_form"] = form_values = parse_multipart_form(  # type: ignore[typeddict-item]
                    body=await self.body(),
                    boundary=options.get("boundary", "").encode(),
                    multipart_form_part_limit=self.app.multipart_form_part_limit,
                )
                return FormMultiDict(form_values)
            if content_type == RequestEncodingType.URL_ENCODED:
                self._form = self.scope["_form"] = form_values = parse_url_encoded_form_data(  # type: ignore[typeddict-item]
                    await self.body(),
                )
                return FormMultiDict(form_values)
            return FormMultiDict()
        return FormMultiDict(self._form)