diff -up ghostscript-9.06/base/gsicc_manage.c.iccprofiles-initdir ghostscript-9.06/base/gsicc_manage.c --- ghostscript-9.06/base/gsicc_manage.c.iccprofiles-initdir 2012-08-09 13:58:22.102364807 +0100 +++ ghostscript-9.06/base/gsicc_manage.c 2012-08-09 14:09:24.495864641 +0100 @@ -38,6 +38,7 @@ #include "gsicc_create.h" #include "gpmisc.h" #include "gxdevice.h" +#include "gxiodev.h" #define ICC_HEADER_SIZE 128 @@ -2176,8 +2177,21 @@ gs_currenticcdirectory(const gs_state * const gs_lib_ctx_t *lib_ctx = pgs->memory->gs_lib_ctx; if (lib_ctx->profiledir == NULL) { - pval->data = (const byte *)rfs; - pval->size = strlen(rfs); + int have_rom_device = 0; + int i; + + for (i = 0; i < gx_io_device_table_count; i++) { + const gx_io_device *iodev = lib_ctx->io_device_table[i]; + const char *dname = iodev->dname; + + if (dname && strlen(dname) == 5 && !memcmp("%rom%", dname, 5)) { + have_rom_device = 1; + break; + } + } + + pval->data = (const byte *)(have_rom_device ? rfs : ""); + pval->size = strlen((const char *)pval->data); pval->persistent = true; } else { pval->data = (const byte *)(lib_ctx->profiledir);