Fossil

Check-in [c9bb729d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Initialize the output buffer for blob_compress prior to invoking zlib in order to avoid valgrind warnings about reading uninitialized memory.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c9bb729d5df44cab1ec52314a51280a25f7cc2b7
User & Date: drh 2011-05-12 14:04:26
Context
2011-05-12
14:17
Back out the previous change, which was bogus. Remove traces of the FOSSIL_I18N compile-time option which is not actually used anywhere in the code anymore. check-in: 0613db18 user: drh tags: trunk
14:04
Initialize the output buffer for blob_compress prior to invoking zlib in order to avoid valgrind warnings about reading uninitialized memory. check-in: c9bb729d user: drh tags: trunk
12:02
Change fossil_malloc() so that it does not report "out of memory" when allocating zero bytes. check-in: 6b382b08 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/blob.c.

781
782
783
784
785
786
787

788
789
790
791
792
793
794
  unsigned int nOut = 13 + nIn + (nIn+999)/1000;
  unsigned long int nOut2;
  unsigned char *outBuf;
  Blob temp;
  blob_zero(&temp);
  blob_resize(&temp, nOut+4);
  outBuf = (unsigned char*)blob_buffer(&temp);

  outBuf[0] = nIn>>24 & 0xff;
  outBuf[1] = nIn>>16 & 0xff;
  outBuf[2] = nIn>>8 & 0xff;
  outBuf[3] = nIn & 0xff;
  nOut2 = (long int)nOut;
  compress(&outBuf[4], &nOut2,
           (unsigned char*)blob_buffer(pIn), blob_size(pIn));







>







781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
  unsigned int nOut = 13 + nIn + (nIn+999)/1000;
  unsigned long int nOut2;
  unsigned char *outBuf;
  Blob temp;
  blob_zero(&temp);
  blob_resize(&temp, nOut+4);
  outBuf = (unsigned char*)blob_buffer(&temp);
  memset(outBuf, 0, nOut+4);
  outBuf[0] = nIn>>24 & 0xff;
  outBuf[1] = nIn>>16 & 0xff;
  outBuf[2] = nIn>>8 & 0xff;
  outBuf[3] = nIn & 0xff;
  nOut2 = (long int)nOut;
  compress(&outBuf[4], &nOut2,
           (unsigned char*)blob_buffer(pIn), blob_size(pIn));