Skip to content

object patch add-link overwrites root node data when child is too small #7190

@ellttBen

Description

@ellttBen

Version information:

go-ipfs version: 0.4.23-
Repo version: 7
System version: amd64/linux
Golang version: go1.13.7

Description:

Hello,

I was trying to add links to other versions of an image to the original's dag node. Though the links are working, accessing the root node yields a child version of the original image instead of the original.

To reproduce, we use two versions of the same image :

  • original : QmcFDihqvEwzgahFora3TU1BRZ84UJRSd2PW43j4buSs6n
  • smaller version : Qmapcp7ey9eUyk98eEK8iDbu7VdUHVtdd1RVsP5Wvqf4Cp

Then, we run

ipfs object patch add-link QmcFDihqvEwzgahFora3TU1BRZ84UJRSd2PW43j4buSs6n "small.jpg" Qmapcp7ey9eUyk98eEK8iDbu7VdUHVtdd1RVsP5Wvqf4Cp

On my machine, this yields QmQbr75jzhPXWFi59uRUrig6U2paGwfKSe8MLuDwC5s8VL.

We can then observe that the above cid doesn't display the original, but the small.jpg link works and yields the same image. In testing, I have noticed that when the small image is larger (my guess is larger than chunk size), this behavior disappears.

In case the images aren't available :

Metadata

Metadata

Assignees

Labels

effort/daysEstimated to take multiple days, but less than a weekexp/intermediatePrior experience is likely helpfulkind/bugA bug in existing code (including security flaws)status/readyReady to be worked

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions