Fossil SCM
When a sync-received file card does not hash to what it claims to, skip storing of the content to avoid that the otherwise-queued blob inevitably triggers fossil_fatal() via the verify-before-commit checks. Reported by Dan Mestas.
Commit
99546127422fb2d6c89b7d574f2d064fcc5468392cf2dcd78091e18cf097bb9c
Parent
54efccf708821bb…
1 file changed
+2
+2
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -208,10 +208,12 @@ | ||
| 208 | 208 | }else{ |
| 209 | 209 | pXfer->nFileRcvd++; |
| 210 | 210 | } |
| 211 | 211 | if( hname_verify_hash(&content, blob_buffer(pUuid), blob_size(pUuid))==0 ){ |
| 212 | 212 | blob_appendf(&pXfer->err, "wrong hash on received artifact: %b", pUuid); |
| 213 | + blob_reset(&content); | |
| 214 | + return; | |
| 213 | 215 | } |
| 214 | 216 | rid = content_put_ex(&content, blob_str(pUuid), 0, 0, isPriv); |
| 215 | 217 | Th_AppendToList(pzUuidList, pnUuidList, blob_str(pUuid), blob_size(pUuid)); |
| 216 | 218 | if( rid==0 ){ |
| 217 | 219 | blob_appendf(&pXfer->err, "%s", g.zErrMsg); |
| 218 | 220 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -208,10 +208,12 @@ | |
| 208 | }else{ |
| 209 | pXfer->nFileRcvd++; |
| 210 | } |
| 211 | if( hname_verify_hash(&content, blob_buffer(pUuid), blob_size(pUuid))==0 ){ |
| 212 | blob_appendf(&pXfer->err, "wrong hash on received artifact: %b", pUuid); |
| 213 | } |
| 214 | rid = content_put_ex(&content, blob_str(pUuid), 0, 0, isPriv); |
| 215 | Th_AppendToList(pzUuidList, pnUuidList, blob_str(pUuid), blob_size(pUuid)); |
| 216 | if( rid==0 ){ |
| 217 | blob_appendf(&pXfer->err, "%s", g.zErrMsg); |
| 218 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -208,10 +208,12 @@ | |
| 208 | }else{ |
| 209 | pXfer->nFileRcvd++; |
| 210 | } |
| 211 | if( hname_verify_hash(&content, blob_buffer(pUuid), blob_size(pUuid))==0 ){ |
| 212 | blob_appendf(&pXfer->err, "wrong hash on received artifact: %b", pUuid); |
| 213 | blob_reset(&content); |
| 214 | return; |
| 215 | } |
| 216 | rid = content_put_ex(&content, blob_str(pUuid), 0, 0, isPriv); |
| 217 | Th_AppendToList(pzUuidList, pnUuidList, blob_str(pUuid), blob_size(pUuid)); |
| 218 | if( rid==0 ){ |
| 219 | blob_appendf(&pXfer->err, "%s", g.zErrMsg); |
| 220 |