Fossil SCM

Fix segfault when dealing with merge conflict involving symlinks (when allow-symlinks is enable) by reducing scope of some Blob local variable.

mgagnon 2024-12-23 18:23 trunk
Commit 1611c972604a6b110e2c6646265939f0bb90addb86b757a9e3153b3f0a29749b
1 file changed +6 -7
+6 -7
--- src/update.c
+++ src/update.c
@@ -514,14 +514,10 @@
514514
zDir = zNext;
515515
}
516516
}
517517
}
518518
}else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
519
- /* Merge the changes in the current tree into the target version */
520
- Blob r, t, v;
521
- int rc;
522
-
523519
if( nameChng ){
524520
fossil_print("MERGE %s -> %s\n", zName, zNewName);
525521
}else{
526522
fossil_print("MERGE %s\n", zName);
527523
}
@@ -528,10 +524,13 @@
528524
if( islinkv || islinkt ){
529525
fossil_print("***** Cannot merge symlink %s\n", zNewName);
530526
zOp = "CONFLICT";
531527
nConflict++;
532528
}else{
529
+ /* Merge the changes in the current tree into the target version */
530
+ Blob r, t, v;
531
+ int rc;
533532
unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0;
534533
if(keepMergeFlag!=0) mergeFlags |= MERGE_KEEP_FILES;
535534
if( !dryRunFlag && !internalUpdate ) undo_save(zName);
536535
content_get(ridt, &t);
537536
content_get(ridv, &v);
@@ -571,15 +570,15 @@
571570
nConflict++;
572571
zOp = "ERROR";
573572
zErrMsg = "cannot merge binary file";
574573
nc = 1;
575574
}
575
+ blob_reset(&v);
576
+ blob_reset(&t);
577
+ blob_reset(&r);
576578
}
577579
if( nameChng && !dryRunFlag ) file_delete(zFullPath);
578
- blob_reset(&v);
579
- blob_reset(&t);
580
- blob_reset(&r);
581580
}else{
582581
nUpdate--;
583582
if( chnged ){
584583
if( verboseFlag ) fossil_print("EDITED %s\n", zName);
585584
}else{
586585
--- src/update.c
+++ src/update.c
@@ -514,14 +514,10 @@
514 zDir = zNext;
515 }
516 }
517 }
518 }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
519 /* Merge the changes in the current tree into the target version */
520 Blob r, t, v;
521 int rc;
522
523 if( nameChng ){
524 fossil_print("MERGE %s -> %s\n", zName, zNewName);
525 }else{
526 fossil_print("MERGE %s\n", zName);
527 }
@@ -528,10 +524,13 @@
528 if( islinkv || islinkt ){
529 fossil_print("***** Cannot merge symlink %s\n", zNewName);
530 zOp = "CONFLICT";
531 nConflict++;
532 }else{
 
 
 
533 unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0;
534 if(keepMergeFlag!=0) mergeFlags |= MERGE_KEEP_FILES;
535 if( !dryRunFlag && !internalUpdate ) undo_save(zName);
536 content_get(ridt, &t);
537 content_get(ridv, &v);
@@ -571,15 +570,15 @@
571 nConflict++;
572 zOp = "ERROR";
573 zErrMsg = "cannot merge binary file";
574 nc = 1;
575 }
 
 
 
576 }
577 if( nameChng && !dryRunFlag ) file_delete(zFullPath);
578 blob_reset(&v);
579 blob_reset(&t);
580 blob_reset(&r);
581 }else{
582 nUpdate--;
583 if( chnged ){
584 if( verboseFlag ) fossil_print("EDITED %s\n", zName);
585 }else{
586
--- src/update.c
+++ src/update.c
@@ -514,14 +514,10 @@
514 zDir = zNext;
515 }
516 }
517 }
518 }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
 
 
 
 
519 if( nameChng ){
520 fossil_print("MERGE %s -> %s\n", zName, zNewName);
521 }else{
522 fossil_print("MERGE %s\n", zName);
523 }
@@ -528,10 +524,13 @@
524 if( islinkv || islinkt ){
525 fossil_print("***** Cannot merge symlink %s\n", zNewName);
526 zOp = "CONFLICT";
527 nConflict++;
528 }else{
529 /* Merge the changes in the current tree into the target version */
530 Blob r, t, v;
531 int rc;
532 unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0;
533 if(keepMergeFlag!=0) mergeFlags |= MERGE_KEEP_FILES;
534 if( !dryRunFlag && !internalUpdate ) undo_save(zName);
535 content_get(ridt, &t);
536 content_get(ridv, &v);
@@ -571,15 +570,15 @@
570 nConflict++;
571 zOp = "ERROR";
572 zErrMsg = "cannot merge binary file";
573 nc = 1;
574 }
575 blob_reset(&v);
576 blob_reset(&t);
577 blob_reset(&r);
578 }
579 if( nameChng && !dryRunFlag ) file_delete(zFullPath);
 
 
 
580 }else{
581 nUpdate--;
582 if( chnged ){
583 if( verboseFlag ) fossil_print("EDITED %s\n", zName);
584 }else{
585

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button