https://registry.khronos.org/OpenGL/specs/gl/glspec46.core.pdf#page=240
The image is taken from the framebuffer exactly as if these arguments were passed to CopyPixels (see section 18.3) with argument type set to COLOR, DEPTH, DEPTH_STENCIL, or STENCIL_INDEX, depending on internalformat, stopping after conversion of depth values.
However, section 18.3 does not mention any behavior for CopyPixels. Funnily enough, the changelog says that this text should be moved into this section, but it seems this was forgotten.
Pixel copying - CopyPixels (the comments also applying to CopyTexImage will be moved to section 8.6).