Fossil SCM
Initialize the output buffer for blob_compress prior to invoking zlib in order to avoid valgrind warnings about reading uninitialized memory.
Commit
c9bb729d5df44cab1ec52314a51280a25f7cc2b7
Parent
6b382b0818157da…
1 file changed
+1
+1
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -783,10 +783,11 @@ | ||
| 783 | 783 | unsigned char *outBuf; |
| 784 | 784 | Blob temp; |
| 785 | 785 | blob_zero(&temp); |
| 786 | 786 | blob_resize(&temp, nOut+4); |
| 787 | 787 | outBuf = (unsigned char*)blob_buffer(&temp); |
| 788 | + memset(outBuf, 0, nOut+4); | |
| 788 | 789 | outBuf[0] = nIn>>24 & 0xff; |
| 789 | 790 | outBuf[1] = nIn>>16 & 0xff; |
| 790 | 791 | outBuf[2] = nIn>>8 & 0xff; |
| 791 | 792 | outBuf[3] = nIn & 0xff; |
| 792 | 793 | nOut2 = (long int)nOut; |
| 793 | 794 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -783,10 +783,11 @@ | |
| 783 | unsigned char *outBuf; |
| 784 | Blob temp; |
| 785 | blob_zero(&temp); |
| 786 | blob_resize(&temp, nOut+4); |
| 787 | outBuf = (unsigned char*)blob_buffer(&temp); |
| 788 | outBuf[0] = nIn>>24 & 0xff; |
| 789 | outBuf[1] = nIn>>16 & 0xff; |
| 790 | outBuf[2] = nIn>>8 & 0xff; |
| 791 | outBuf[3] = nIn & 0xff; |
| 792 | nOut2 = (long int)nOut; |
| 793 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -783,10 +783,11 @@ | |
| 783 | unsigned char *outBuf; |
| 784 | Blob temp; |
| 785 | blob_zero(&temp); |
| 786 | blob_resize(&temp, nOut+4); |
| 787 | outBuf = (unsigned char*)blob_buffer(&temp); |
| 788 | memset(outBuf, 0, nOut+4); |
| 789 | outBuf[0] = nIn>>24 & 0xff; |
| 790 | outBuf[1] = nIn>>16 & 0xff; |
| 791 | outBuf[2] = nIn>>8 & 0xff; |
| 792 | outBuf[3] = nIn & 0xff; |
| 793 | nOut2 = (long int)nOut; |
| 794 |