Comments (4)
Maybe not the best place for a patch... if you need a better way to submit it tell me (e.g. mailing, or forking the code and pointing to the forked repository)
--- Fileold.cpp Wed Jan 11 07:19:38 2012
+++ File.cpp Sat Oct 20 23:00:41 2012
@@ -38,6 +38,11 @@
#include <unistd.h>
#include <stdio.h>
+#if defined(WIN32) || defined(CYGWIN)
+#include <io.h>
+#include <fcntl.h>
+#endif /* WIN32 || CYGWIN */
+
#include "af_vfs.h"
class FilePOSIX : public File
@@ -84,6 +89,9 @@
int fd = ::open(path, flags, 0666);
if (fd == -1)
return NULL;
+#if defined(WIN32) || defined(CYGWIN)
- _setmode(fd, _O_BINARY);
+#endif /* WIN32 || CYGWIN */
File *file = new FilePOSIX(fd, mode);
return file;
}
from audiofile.
Hi Fabrizio, thanks for catching this problem and for suggesting a fix. The following is slightly simpler; does it seem reasonable to you?
diff --git a/libaudiofile/File.cpp b/libaudiofile/File.cpp index 36fecdb..089b182 100644 --- a/libaudiofile/File.cpp +++ b/libaudiofile/File.cpp @@ -81,6 +81,9 @@ File *File::open(const char *path, File::AccessMode mode) flags = O_RDONLY; else if (mode == WriteAccess) flags = O_CREAT | O_WRONLY | O_TRUNC; +#if defined(WIN32) || defined(__CYGWIN__) + flags |= O_BINARY; +#endif int fd = ::open(path, flags, 0666); if (fd == -1) return NULL;
from audiofile.
Yes, tested and it works, and it looks like a very clean solution.
from audiofile.
Thanks for proposing this change. It's checked in as commit 946bf19.
from audiofile.
Related Issues (20)
- heap-based buffer overflow in ulaw2linear_buf (G711.cpp) HOT 2
- divide-by-zero in BlockCodec::reset1 (BlockCodec.cpp) HOT 2
- heap-based buffer overflow in Expand3To4Module::run (SimpleModule.h) HOT 5
- multiple ubsan crashes HOT 1
- heap-based buffer overflow in ulaw2linear_buf HOT 1
- Memory leak in AUpvnew
- heap-based buffer overflow in FilePOSIX::read
- NULL pointer dereference in ModuleState::setup, in ModuleState.cpp HOT 1
- A heap-buffer-overflow has occurred when running sfconvert HOT 1
- A heap-buffer-overflow has occurred when running sfconvert HOT 1
- New Release HOT 9
- NULL pointer dereference bug in ulaw2linear_buf, in G711.cpp HOT 5
- out of bound heap access in SimpleModule.h HOT 1
- one heap buffer overflow in FilePOSIX::read in File.cpp HOT 2
- make[2]: *** No rule to make target 'afIdentifyNamedFD.3', needed by 'all-am'. Stop. HOT 2
- Memory-leak bug in printfileinfo, in printinfo.c HOT 2
- 0.3.6 + all up to b62c902d: test suite is failing when source code is configured with `--disable-static` and LTO is used
- 0.3.6 + all up to b62c902d: parallel documentation build fails
- audio artifacts when decoding AIFF-C
- Unary_function is deprecated since c++11 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audiofile.