Skip to content

win: fs-event.c crashes on Windows #693

Description

@jorangreef

I have been working on a backup tool which makes use of fs.watch via Electron.

A fuzz test was causing the process to crash after 20 minutes on Windows 10 but not on Windows 7 and I have been tracking this down for the past few months. There are no native modules in use, only core modules. I originally filed electron/electron#3978 with Electron thinking the problem lay in a major Electron update (it was fine in previous versions <= v0.30.4).

I now think the problem is to do with the handling of fairly long paths being processed by fs-event.c in libuv possibly together with improper handling for different Unicode normalization forms, resulting in a buffer overflow or inadequate string length being measured or something along those lines.

Here is a gist which will reliably reproduce the issue on Windows 10 (but not on Windows 7): https://gist.github.com/jorangreef/c9d9014abf53ae6d5ec4

After observing the crash, you can comment out the fs.watch call to see that the script then passes.

Would anyone be able to review the fs-event.c code and see how this might be happening?

UPDATE: This actually affected all versions of Windows, not just Windows 10.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions