adobe-flash / crossbridge

Welcome to visit the homepage!
http://www.crossbridge.io
542 stars 196 forks source link

fopen with directories makes fseek throw #60

Open mhenschel opened 10 years ago

mhenschel commented 10 years ago

I created an embedded in memory backing store containing a directory with some files in it. In my C++ code I accidentally tried to fopen the directory instead of a file. The fopen works but when I try to seek to the end of the opened file (to get the file size by calling ftell) there is a null reference exception in "PlayerKernel.lseekImpl"

For example:

  1. This is the directory structure /directory/file.txt
  2. This is the code that leads to the bug FILE* file=fopen("directory"); if (file) { fseek(File, 0, SEEK_END); }

I think opening a directory might be undefined behavior in C++ but throwing exceptions into native C code in an fseek call is a problem. IMHO a reasonable thing to do would be to let the fopen call just fail for directories.

JoeDupuis commented 10 years ago

Adobe doesn seem to maintains the project anymore has they state in their last commit :

"Sadly this project is no longer being actively maintained by Adobe, if you want to contribute to improving crossbridge you might want to help out on a more active fork like the one here: https://github.com/vpmedia/crossbridge/"

You could post a feature request on this repo which is still maintained by the community : https://github.com/crossbridge-community/crossbridge

but it might never be worked on if it is undefined in the C standard.

JoeDupuis commented 10 years ago

Oh I see you already posted