diff --git a/libvips/foreign/radiance.c b/libvips/foreign/radiance.c index 57fbae83..6903221b 100644 --- a/libvips/foreign/radiance.c +++ b/libvips/foreign/radiance.c @@ -1295,11 +1295,16 @@ static int vips2rad_put_data_block( VipsRegion *region, VipsRect *area, void *a ) { Write *write = (Write *) a; - size_t size; - unsigned char *buffer = vips_dbuf_get_write( &write->dbuf, &size ); + size_t size; + unsigned char *buffer; int i; + /* You have to seek back after a write. + */ + buffer = vips_dbuf_get_write( &write->dbuf, &size ); + vips_dbuf_seek( &write->dbuf, 0, SEEK_SET ); + g_assert( size >= MAX_LINE ); for( i = 0; i < area->height; i++ ) {