COM: Fix filling arrays with more than 4G cells
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
901b5af311
commit
0f412d5c38
@ -10,9 +10,10 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <unknwn.h>
|
#include <intsafe.h>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <unknwn.h>
|
||||||
|
|
||||||
namespace winstd
|
namespace winstd
|
||||||
{
|
{
|
||||||
@ -1507,7 +1508,9 @@ namespace winstd
|
|||||||
///
|
///
|
||||||
inline _Ret_notnull_ LPSAFEARRAY BuildSAFEARRAY(_In_ VARTYPE vt, _In_opt_ LPCVOID array, _In_ ULONG columns, _In_ ULONG rows)
|
inline _Ret_notnull_ LPSAFEARRAY BuildSAFEARRAY(_In_ VARTYPE vt, _In_opt_ LPCVOID array, _In_ ULONG columns, _In_ ULONG rows)
|
||||||
{
|
{
|
||||||
const size_t n = columns * rows;
|
SIZE_T n;
|
||||||
|
if (FAILED(SIZETMult(columns, rows, &n)))
|
||||||
|
throw std::invalid_argument("array is too big");
|
||||||
if (!array && n)
|
if (!array && n)
|
||||||
throw std::invalid_argument("array is NULL");
|
throw std::invalid_argument("array is NULL");
|
||||||
|
|
||||||
@ -1559,7 +1562,9 @@ namespace winstd
|
|||||||
///
|
///
|
||||||
inline VARIANT BuildVBARRAY(_In_ VARTYPE vt, _In_opt_ LPCVOID array, _In_ ULONG columns, _In_ ULONG rows)
|
inline VARIANT BuildVBARRAY(_In_ VARTYPE vt, _In_opt_ LPCVOID array, _In_ ULONG columns, _In_ ULONG rows)
|
||||||
{
|
{
|
||||||
const size_t n = columns * rows;
|
SIZE_T n;
|
||||||
|
if (FAILED(SIZETMult(columns, rows, &n)))
|
||||||
|
throw std::invalid_argument("array is too big");
|
||||||
if (!array && n)
|
if (!array && n)
|
||||||
throw std::invalid_argument("array is NULL");
|
throw std::invalid_argument("array is NULL");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user