backu...@kosowsky.org wrote at about 08:08:37 -0400 on Thursday, April 4, 2019:
 > When I run 'BackupPC_migrateV3toV4' (v4.3.0), I get occasional errors
 > of form:
 >    setVarInt botch: got negative argument -1015087104; setting to 0
 > 
 > 
 > NOTE: that the error is rare -- I migrated about 2 million pool files
 > repeated across 100 backups... yet I only encountered a couple of
 > dozen such errors.
 > 
 > Note the error seems to be generated in bpc_attrib.c in the following
 > subroutine:
 > 
 > /*
 >  * Write variable-length unsigned integer in 7 bit chunks, LSB first
 >  */
 > static void setVarInt(uchar **bufPP, uchar *bufEnd, int64 value)
 > {
 >     uchar *bufP = *bufPP;
 > 
 >     if ( value < 0 ) {
 >             bpc_logErrf("setVarInt botch: got negative argument %ld;
 >             setting to 0\n", (long int)value);
 >             value = 0;
 >      }
 >      do {
 >              uchar c = value & 0x7f;
 >           value >>= 7;
 >           if ( value ) c |= 0x80;
 >           if ( bufP < bufEnd ) {
 >           *bufP++ = c;
 >                   } else {
 >                          bufP++;
 >              }
 >       } while ( value );
 >       *bufPP = bufP;
 > }
 > 
 > 
 > ------------------------------------------
 > 
 > Here is some context from the (verbose) output of
 > BackupPC_migrateV3toV4:
 > 
 >      Wrote file 
 > cache_http%3A%2F%2Fi.ebayimg.com%2F00%2Fs%2FMTc2WDE3Ng%3D%3D%2F%24%28KGrHqNHJE%21FCdYT6%21EDBQt9otljTQ%7E%7E60_57.PNG%3Fset_id%3D4002:
 >  type = 0, mode = 0100444, uid/gid = 490/490, size = 49237, inode = 231882, 
 > nlinks = 0, digest = 0x0cb6af..., bufUsed = 636
 >      Wrote file 
 > cache_http%3A%2F%2Fi.ebayimg.com%2F00%2Fs%2FMjExWDMwNg%3D%3D%2Fz%2Fo5UAAOxyMQtSaXHu%2F%24%28KGrHqZHJBoFJfGTBIQCBS%2C%28HuG2FQ%7E%7E60_57.PNG%3Fset_id%3D4002:
 >  type = 0, mode = 0100444, uid/gid = 490/490, size = 10548, inode = 231885, 
 > nlinks = 0, digest = 0x79a2c2..., bufUsed = 810
 >      setVarInt botch: got negative argument -1015087104; setting to 0
 >      Wrote file 
 > cache_http%3A%2F%2Fi.ebayimg.com%2F00%2Fs%2FMTE3WDMxNA%3D%3D%2Fz%2FH7sAAOxyRNJScAaq%2F%24%28KGrHqF%2C%21k8FJlR29NWMBSc%21%2Cp7SSw%7E%7E60_57.PNG%3Fset_id%3D4002:
 >  type = 0, mode = 00, uid/gid = 0/0, size = 0, inode = 231883, nlinks = 0, 
 > digest = 0x7b428e..., bufUsed = 1006
 >      Wrote file 
 > cache_http%3A%2F%2Fi.ebayimg.com%2F00%2Fs%2FMzMxWDQwMA%3D%3D%2Fz%2FFMgAAOxydgZTI2GK%2F%24_1.JPG%3Fset_id%3D2:
 >  type = 0, mode = 0100444, uid/gid = 490/490, size = 17859, inode = 231884, 
 > nlinks = 0, digest = 0x99c51e..., bufUsed = 1197
 >      Wrote file 
 > cache_http%3A%2F%2Fi.ebayimg.com%2F00%2Fs%2FMTc2WDE3Ng%3D%3D%2F%24T2eC16ZHJHIE9nyseyoZBQt9oyl1o%21%7E%7E60_57.PNG%3Fset_id%3D4002:
 >  type = 0, mode = 0100444, uid/gid = 490/490, size = 15206, inode = 231881, 
 > nlinks = 0, digest = 0x97c615..., bufUsed = 1345

Cause here is the same as in the other bug thread I reported.
The problem is that getVarInt is used instead of
getVarInt_v3 in bpc_attrib_dirRead in places where we are reading a v3
rather than v4 attrib file.

Here is a simple patch:

--- libbackuppc-xs-perl-0.58.orig/bpc_attrib.c
+++ libbackuppc-xs-perl-0.58/bpc_attrib.c
@@ -917,7 +917,7 @@ int bpc_attrib_dirRead(bpc_attrib_dir *d
                 return -1;
                              }

-            fileNameLen = getVarInt(&bufP, buf + nRead);
+            fileNameLen = getVarInt_v3(&bufP, buf + nRead);
             if ( fileNameLen > 2 * BPC_MAXPATHLEN - 16 ) {
                 bpc_logErrf("bpc_attrib_dirRead: got unreasonable file name 
length %d\n", fileNameLen);
                 bpc_fileZIO_close(&fd);


_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Reply via email to