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/inc/cheapcgi.h src/inc/cheapcgi.h
index 30db46edd9d..d0f3124b87f 100644
--- src/inc/cheapcgi.h
+++ src/inc/cheapcgi.h
@@ -84,30 +84,42 @@
 /* set handler for various terminal signals for logging purposes.
  * if dumpStack is TRUE, attempt to dump the stack. */
 
 struct cgiVar
 /* Info on one cgi variable. */
     {
     struct cgiVar *next;	/* Next in list. */
     char *name;			/* Name - allocated in hash. */
     char *val;  		/* Value - also not allocated here. */
     boolean saved;		/* True if saved. */
     };
 
 struct cgiVar* cgiVarList();
 /* return the list of cgiVar's */
 
+char *cgiMemBlobRegister(char *mem, unsigned long size);
+/* Record a block of memory that may be named by address in a cgi or cart
+ * variable, and return the "<address> <size>" text that names it.  The
+ * returned string is allocated here and belongs to the caller. */
+
+char *cgiMemBlobFind(char *spec, unsigned long *retSize);
+/* Return the block of memory named by spec, which is "<address> <size>" text
+ * made by cgiMemBlobRegister or by an uploaded file part.  Return NULL if this
+ * program never registered such a block, in which case the address came from
+ * the request rather than from us and must not be used.  If retSize is not
+ * NULL the size of the block is returned in it. */
+
 struct cgiDictionary
 /* Stuff to encapsulate parsed out CGI vars. */
     {
     struct cgiDictionary *next;	    /* Next in list if we have multiple */
     char *stringData;		    /* Where values if cgi-vars live. */
     struct hash *hash;		    /* Keyed by cgi-var name, value is cgiVar */
     struct cgiVar *list;	    /* List of all vars. */
     };
 
 void cgiDictionaryFree(struct cgiDictionary **pD);
 /* Free up resources associated with dictionary. */
 
 void cgiDictionaryFreeList(struct cgiDictionary **pList);
 /* Free up a whole list of cgiDictionaries */