open-discussion > Buffer overflow in mricron
Showing 1-2 of 2 posts
Display:
Results per page:
Apr 1, 2021  02:04 PM | Vincenzo Ciancia
Buffer overflow in mricron
Hi,

mricron (latest version, from 2019, reproduced on osx and linux) suffers from a mild buffer overflow: if the image path is too long, the image is not displayed; garbage is shown instead. This was observed on a normal installation, due to a particularly large nesting of subdirectories from an user at ISTI-CNR in Pisa.

Example to reproduce using bash and gnu find:

1) create a long path:

mkdir testPath; for i in $(seq 1 200); do mkdir $(find testPath | tail -n 1)/testPath; done


2) copy an image in the path:

cp flair.nii.gz $(find testPath/|tail -n 1)

3) open that image:

/path/to/MRIcron $(find testPath -iname "*.nii.gz")

4) Garbled content is observed instead of the image.
Apr 1, 2021  02:04 PM | Chris Rorden
RE: Buffer overflow in mricron
Is the problem specific to compressed .nii.gz files or does it also impact .nii files? Notice MAX_PATH can vary between operating systems, e.g. 
 https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
 https://discussions.apple.com/thread/250275651