| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cddbec2 commit eba3d3d
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,17 +95,19 @@ void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>& args) { | |||
| 95 | 95 | #ifdef _WIN32 | |
| 96 | 96 | // emulate snprintf() on windows, _snprintf() doesn't zero-terminate the buffer | |
| 97 | 97 | // on overflow... | |
| 98 | + // VS 2015 added a standard conform snprintf | ||
| 99 | + #if defined( _MSC_VER ) && (_MSC_VER < 1900) | ||
| 98 | 100 | #include <stdarg.h> | |
| 99 | - inline static int snprintf(char* buf, unsigned int len, const char* fmt, ...) { | ||
| 100 | - va_list ap; | ||
| 101 | - va_start(ap, fmt); | ||
| 102 | - int n = _vsprintf_p(buf, len, fmt, ap); | ||
| 103 | - if (len) | ||
| 104 | - buf[len - 1] = '\0'; | ||
| 105 | - va_end(ap); | ||
| 106 | - return n; | ||
| 101 | + inline static int snprintf(char *buffer, size_t n, const char *format, ...) { | ||
| 102 | + va_list argp; | ||
| 103 | + va_start(argp, format); | ||
| 104 | + int ret = _vscprintf(format, argp); | ||
| 105 | + vsnprintf_s(buffer, n, _TRUNCATE, format, argp); | ||
| 106 | + va_end(argp); | ||
| 107 | + return ret; | ||
| 107 | 108 | } | |
| 108 | 109 | #endif | |
| 110 | + #endif | ||
| 109 | 111 | ||
| 110 | 112 | #if defined(__x86_64__) | |
| 111 | 113 | # define BITS_PER_LONG 64 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,11 +54,16 @@ errExec('throws_error4.js', function(err, stdout, stderr) { | |||
| 54 | 54 | assert.ok(/SyntaxError/.test(stderr)); | |
| 55 | 55 | }); | |
| 56 | 56 | ||
| 57 | - // Long exception line doesn't result in stack overflow | ||
| 57 | + // Specific long exception line doesn't result in stack overflow | ||
| 58 | 58 | errExec('throws_error5.js', function(err, stdout, stderr) { | |
| 59 | 59 | assert.ok(/SyntaxError/.test(stderr)); | |
| 60 | 60 | }); | |
| 61 | 61 | ||
| 62 | + // Long exception line with length > errorBuffer doesn't result in assertion | ||
| 63 | + errExec('throws_error6.js', function(err, stdout, stderr) { | ||
| 64 | + assert.ok(/SyntaxError/.test(stderr)); | ||
| 65 | + }); | ||
| 66 | + | ||
| 62 | 67 | process.on('exit', function() { | |
| 63 | - assert.equal(5, exits); | ||
| 68 | + assert.equal(6, exits); | ||
| 64 | 69 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments