When using GPG as a filter (eg "cat thefile.gpg | gpg > output.txt"), if the
filesystem being written to is full, and the plaintext inside thefile.gpg small
enough, GPG can end up not writing the complete output, but will return success
back to the caller.
What seems to be happening is in plaintext.c:handle_plaintext(). At the end of
the function, the FILE * being written to is fclosed, but only if it isn't
stdout. In the filter case, of course, the output will be stdout, so it won't
get closed. Shortly afterwards, there is a fflush(stdout), but the return code
from this isn't checked. If the plaintext data is small enough so that the
stdio buffer was never flushed, then the first time there is a "real" write will
be when stdout is fflushed. The end result is that the data is not written to
disk (because the disk is full), but yet GPG thinks it was and returns success
back to the caller.
The fix should be fairly simple - just check the return code of that fflush. In
the filter case, this is important. In the non-filter case, it's harmless to check.