scipipe icon indicating copy to clipboard operation
scipipe copied to clipboard

Potential Seg Fault in Task.AtomizeIPs

Open dwmunster opened this issue 5 years ago • 2 comments

https://github.com/scipipe/scipipe/blob/91e3ee76fe836fb74b08593dde9ab2ca8cf33e06/task.go#L350-L363

For the walk function above, if the error is not nil, fileInfo may be nil, causing L351 to raise a seg fault. https://golang.org/pkg/path/filepath/#Walk suggests that it is the caller's responsibility to filter any errors that arise in the walk.

I ran into this issue by trying to use Task.CustomExecute to add tags. However, adding tags changes the result from Task.TempDir, thus Task.AtomizeIPs attempts to walk a non-existent directory.

dwmunster avatar Mar 13 '20 12:03 dwmunster

@dwmunster Ah, so, if I understand correctly, there is the problem that tags might be added/created after the folder hash is generated? Good catch!

samuell avatar Mar 18 '20 09:03 samuell

That is correct. Since the custom execute method has access to the Task, it could potentially change any of the hashed fields used for Task.TempDir except for the substream IPs that aren't exported.

Perhaps the temp directory name should be saved on the Task after the first call and subsequent calls to Task.TempDir() return that path. Alternatively, changing things like tags inside a custom execute doesn't have to be supported, could handle the potential nil case above and error out.

Side note: I was able to accomplish what I needed with the MapToTags component.

dwmunster avatar Mar 18 '20 10:03 dwmunster