gpgme_data_seek with SEEK_END on memory-based data fails

Leo Gaspard ekleog at
Sat Jul 28 20:51:54 CEST 2012

Hello all !

I recently stumbled upon a strange result while using gpgme_data_seek(data, off, 

So, I read the source code for this function (and had a quite hard time crawling 
to finally find mem_seek).

It looks like there is an error in the function : the offset is negative but is 
then substracted from the position, which results in an out-of-bounds pointer 
and then in a crash.

Proposed "patch" : file "src/data-mem.c", line 140, turn the "minus" into a "plus".

Hope that helps,

Leo Gaspard

More information about the Gnupg-devel mailing list