7181c0af889a0eee451b91ff0b23d67f35e0e772 braney Tue Aug 18 08:39:08 2026 -0700 cheapcgi, customTrack, hgSession, hgPhyloPlace: track in-memory uploads in a registry Uploaded file contents are handed to the reading code as a text address and size. Collect that bookkeeping in cheapcgi, which now records each block it makes and hands back a name for it, and have the custom track, session and phyloPlace upload paths look the block up by that name. Also removes the duplicated address/size parsing those callers each had, and makes lineFileDecompressMem ignore a too-small buffer. refs #38108 diff --git src/lib/linefile.c src/lib/linefile.c index 7d4e281e9a3..821a6eb1b93 100644 --- src/lib/linefile.c +++ src/lib/linefile.c @@ -158,30 +158,32 @@ struct pipeline *pl; struct lineFile *lf; pl = pipelineOpenFd1(getDecompressor(name), pipelineRead|pipelineSigpipe, fd, STDERR_FILENO, 0); lf = lineFileAttach(name, zTerm, pipelineFd(pl)); lf->pl = pl; return lf; } struct lineFile *lineFileDecompressMem(bool zTerm, char *mem, long size) /* open a linefile with decompression from a memory stream */ { struct pipeline *pl; struct lineFile *lf; +if (mem == NULL || size < 4) /* the longest signature tested is 4 bytes */ + return NULL; char *fileName = getFileNameFromHdrSig(mem); if (fileName==NULL) return NULL; pl = pipelineOpenMem1(getDecompressor(fileName), pipelineRead|pipelineSigpipe, mem, size, STDERR_FILENO, 0); lf = lineFileAttach(fileName, zTerm, pipelineFd(pl)); lf->pl = pl; return lf; } struct lineFile *lineFileAttach(char *fileName, bool zTerm, int fd) /* Wrap a line file around an open'd file. */ { struct lineFile *lf;