Compare commits

..

19 Commits

Author SHA1 Message Date
df3382c616 Merge pull request #305 from ONLYOFFICE/fix/v5.6.4_bin
x2t - fix #46353
2020-08-31 19:52:58 +03:00
70c886cd9a x2t - fix #46353 2020-08-31 19:51:30 +03:00
8cb6415915 Merge pull request #303 from ONLYOFFICE/fix/v5.6.4_bin
x2t - fix bug #46348
2020-08-31 09:45:12 +03:00
279eaed9c8 x2t - fix bug #46348 2020-08-31 09:43:51 +03:00
078aa9c5e7 Merge pull request #302 from ONLYOFFICE/fix/bug-46384
[x2t] Fix bug 46384
2020-08-30 16:08:23 +03:00
b76463f8d1 [x2t] Fix bug 46384
Fix omitted break statement in switch
2020-08-30 16:06:00 +03:00
a2110b9947 Merge pull request #301 from ONLYOFFICE/fix/bug-46352
[x2t] Fix bug 46352
2020-08-28 14:30:47 +03:00
de2c16ed7c [x2t] Fix bug 46352
Fix out_of_range while binary reading
2020-08-28 14:25:31 +03:00
5aa32a21f6 Merge pull request #300 from ONLYOFFICE/fix/v5.6.4_bin
x2t - binary - fix bug #46352
2020-08-28 13:07:30 +03:00
bec0a59ac1 x2t - binary - fix bug #46352 2020-08-28 13:05:18 +03:00
9024feaf5d Merge pull request #299 from ONLYOFFICE/fix/v5.6.4_bin
x2t - binary - fix bug #46353
2020-08-28 12:49:33 +03:00
078d3bc991 x2t - binary - fix bug #46353 2020-08-28 12:47:24 +03:00
ef6af5a1ae Merge branch hotfix/v5.6.1 into master 2020-08-05 09:19:35 +00:00
6e5fe1202e Merge pull request #278 from ONLYOFFICE/fix/fixXP
Fix xp build
2020-08-03 12:00:48 +03:00
0005b20095 Fix xp build 2020-08-03 11:29:19 +03:00
82cdd75365 Merge branch hotfix/v5.6.0 into master 2020-07-28 13:31:16 +00:00
3410e157e0 Merge pull request #272 from ONLYOFFICE/feature/fixIOSBoost
Fix ios build
2020-07-21 16:02:46 +03:00
92d0edeb48 Fix ios build 2020-07-21 15:55:55 +03:00
ce397b13f6 Fix bug with redirects in downloads 2020-07-10 16:31:37 +03:00
15 changed files with 161 additions and 65 deletions

View File

@ -112,7 +112,9 @@ public:
long read1defCurPos = 0;\
while(read1defCurPos < (long)stLen)\
{\
BYTE read1defType = m_oBufferedStream.GetUChar();\
BYTE read1defType = 0;\
if (false == m_oBufferedStream.GetUCharWithResult(&read1defType))\
break;\
long read1defLength = m_oBufferedStream.GetLong();\
res = fReadFunction(read1defType, read1defLength, arg);\
if(res == c_oSerConstants::ReadUnknown)\
@ -129,7 +131,9 @@ public:
long read2defCurPos = 0;\
while(read2defCurPos < (long)stLen)\
{\
BYTE read2defType = m_oBufferedStream.GetUChar();\
BYTE read2defType = 0;\
if (false == m_oBufferedStream.GetUCharWithResult(&read2defType))\
break;\
long read2defLenType = m_oBufferedStream.GetUChar();\
int read2defCurPosShift = 2;\
int read2defRealLen;\

View File

@ -459,7 +459,7 @@ void OoxConverter::convert(PPTX::Logic::ChartRec *oox_chart)
odf_context()->drawing_context()->start_group();
odf_context()->drawing_context()->set_group_size (width, height, width, height);
odf_context()->drawing_context()->set_group_position (x, y, 0, 0);
odf_context()->drawing_context()->set_group_position (x, y, 0., 0.);
odf_context()->drawing_context()->start_drawing();
odf_context()->drawing_context()->set_position (zero, zero);

View File

@ -52,6 +52,7 @@
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../PPTXFormat/FileContainer.h"
#include <iostream>
#define BYTE_SIZEOF sizeof(BYTE)
#define UINT16_SIZEOF sizeof(_UINT16)
@ -1531,7 +1532,7 @@ namespace NSBinPptxRW
std::wstring strOleRelsPath;
oRelsGeneratorInfo.nOleRId = m_lNextRelsID++;
oRelsGeneratorInfo.nOleRId = m_lNextRelsID++;
oRelsGeneratorInfo.sFilepathOle = oleFile->filename().GetPath();
if (m_pManager->m_nDocumentType != XMLWRITER_DOC_TYPE_XLSX)
@ -1561,7 +1562,7 @@ namespace NSBinPptxRW
std::wstring strMediaRelsPath;
oRelsGeneratorInfo.nMediaRId = m_lNextRelsID++;
oRelsGeneratorInfo.nMediaRId = m_lNextRelsID++;
oRelsGeneratorInfo.sFilepathOle = mediaFile->filename().GetPath();
if (m_pManager->m_nDocumentType != XMLWRITER_DOC_TYPE_XLSX)
@ -1702,7 +1703,10 @@ namespace NSBinPptxRW
int CBinaryFileReader::Seek(LONG _pos)
{
if (_pos > m_lSize)
return 1;
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
m_lPos = _pos;
m_pDataCur = m_pData + m_lPos;
return 0;
@ -1719,10 +1723,25 @@ namespace NSBinPptxRW
}
// 1 bytes
bool CBinaryFileReader::GetUCharWithResult(BYTE *value_)
{
if (!value_ || m_lPos >= m_lSize)
{
return false;
}
*value_ = *m_pDataCur;
++m_lPos;
++m_pDataCur;
return true;
}
BYTE CBinaryFileReader::GetUChar()
{
if (m_lPos >= m_lSize)
return 0;
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
BYTE res = *m_pDataCur;
++m_lPos;
@ -1732,7 +1751,10 @@ namespace NSBinPptxRW
signed char CBinaryFileReader::GetChar()
{
if (m_lPos >= m_lSize)
return 0;
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
BYTE res = *m_pDataCur;
if (res > 127)
@ -1763,7 +1785,10 @@ namespace NSBinPptxRW
_UINT16 CBinaryFileReader::GetUShort()
{
if (m_lPos + 1 >= m_lSize)
return 0;
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
#if defined(_IOS) || defined(__ANDROID__)
_UINT16 res = 0;
memcpy(&res, m_pDataCur, sizeof(_UINT16));
@ -1777,7 +1802,11 @@ namespace NSBinPptxRW
_INT16 CBinaryFileReader::GetShort()
{
if (m_lPos + 1 >= m_lSize)
return 0;
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
#if defined(_IOS) || defined(__ANDROID__)
_INT16 res = 0;
memcpy(&res, m_pDataCur, sizeof(_INT16));
@ -1793,7 +1822,11 @@ namespace NSBinPptxRW
_UINT32 CBinaryFileReader::GetULong()
{
if (m_lPos + 3 >= m_lSize)
return 0;
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
#if defined(_IOS) || defined(__ANDROID__)
_UINT32 res = 0;
memcpy(&res, m_pDataCur, sizeof(_UINT32));
@ -1807,7 +1840,11 @@ namespace NSBinPptxRW
_INT64 CBinaryFileReader::GetLong64()
{
if (m_lPos + 7 >= m_lSize)
return 0;
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
#if defined(_IOS) || defined(__ANDROID__)
_INT64 res = 0;
memcpy(&res, m_pDataCur, sizeof(_INT64));
@ -1833,7 +1870,11 @@ namespace NSBinPptxRW
double CBinaryFileReader::GetDoubleReal()
{
if (m_lPos + (int)DOUBLE_SIZEOF > m_lSize)
return 0;
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
#if defined(_IOS) || defined(__ANDROID__)
double res = 0.0;
memcpy(&res, m_pDataCur, sizeof(double));
@ -1856,7 +1897,10 @@ namespace NSBinPptxRW
if (len < 1 )
return "";
if (m_lPos + len > m_lSize)
return "";
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
std::string res((CHAR*)m_pDataCur, len);
m_lPos += len;
@ -1873,7 +1917,10 @@ namespace NSBinPptxRW
if (len < 1 )
return _T("");
if (m_lPos + len > m_lSize)
return _T("");
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
_UINT32 lSize = len >>1; //string in char
@ -1902,7 +1949,10 @@ namespace NSBinPptxRW
if (len < 1)
return _T("");
if (m_lPos + len > m_lSize)
return _T("");
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
_UINT32 lSize = len >> 1; //string in char
@ -1979,7 +2029,10 @@ namespace NSBinPptxRW
if (nSize < 0) return 0;
if (m_lPos + nSize > m_lSize)
return 0;
{
std::cerr << "CBinaryFileReader out_of_range"<< std::endl;
throw std::out_of_range("CBinaryFileReader out_of_range");
}
BYTE* res = (BYTE*)m_pDataCur;
m_lPos += nSize;

View File

@ -512,6 +512,7 @@ namespace NSBinPptxRW
bool Peek (LONG nSizeToRead);
// 1 bytes
bool GetUCharWithResult(BYTE *value);
BYTE GetUChar();
signed char GetChar();
bool GetBool();

View File

@ -192,10 +192,14 @@ namespace NSBinPptxRW
for (LONG i = 0; i < 30/*main tables max*/; ++i)
{
BYTE _type = m_oReader.GetUChar();
if (0 == _type)
break;
BYTE _type = 0;
if (false == m_oReader.GetUCharWithResult(&_type))
break;
if (0 == _type)
break;
m_mainTables.insert(std::pair<BYTE, LONG>(_type, m_oReader.GetLong()));
}

View File

@ -314,22 +314,30 @@ namespace PPTX
pDstBuffer = (BYTE*) __s.c_str();
dstLen = len;
}
if (sImageExtension.length() < 1)
{
CImageFileFormatChecker checker;
sImageExtension = checker.DetectFormatByData(pDstBuffer, dstLen);
}
//папки media может не быть в случае, когда все картинки base64(поскольку файл временный, папку media не создаем)
std::wstring tempFilePath = pReader->m_strFolder + FILE_SEPARATOR_STR;
OOX::CPath pathTemp = NSFile::CFileBinary::CreateTempFileWithUniqueName(tempFilePath, _T("img")) + _T(".") + sImageExtension;
CImageFileFormatChecker checker;
std::wstring detectImageExtension = checker.DetectFormatByData(pDstBuffer, dstLen);
CFile oTempFile;
oTempFile.CreateFile(pathTemp.GetPath());
oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen);
oTempFile.CloseFile();
strImagePath = strTempFile =pathTemp.GetPath(); // strTempFile для удаления
if (false == detectImageExtension.empty())
{
if (sImageExtension.empty())
sImageExtension = detectImageExtension;
//папки media может не быть в случае, когда все картинки base64(поскольку файл временный, папку media не создаем)
std::wstring tempFilePath = pReader->m_strFolder + FILE_SEPARATOR_STR;
OOX::CPath pathTemp = NSFile::CFileBinary::CreateTempFileWithUniqueName(tempFilePath, _T("img")) + _T(".") + sImageExtension;
CFile oTempFile;
oTempFile.CreateFile(pathTemp.GetPath());
oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen);
oTempFile.CloseFile();
strImagePath = strTempFile =pathTemp.GetPath(); // strTempFile для удаления
}
else
{// бяка
strImagePath.clear();
}
if (bBase64)
{
RELEASEARRAYOBJECTS(pDstBuffer);

View File

@ -485,6 +485,7 @@ namespace PPTX
defRPr = new Logic::RunProperties();
defRPr->m_name = _T("a:defRPr");
defRPr->fromPPTY(pReader);
break;
}
default:
{

View File

@ -332,25 +332,33 @@ namespace PPTX
pDstBuffer = (BYTE*) __s.c_str();
dstLen = len;
}
if (sImageExtension.length() < 1)
{
CImageFileFormatChecker checker;
sImageExtension = checker.DetectFormatByData(pDstBuffer, dstLen);
}
//папки media может не быть в случае, когда все картинки base64(поскольку файл временный, папку media не создаем)
std::wstring tempFilePath = pReader->m_strFolder + FILE_SEPARATOR_STR;
OOX::CPath pathTemp = NSFile::CFileBinary::CreateTempFileWithUniqueName(tempFilePath, _T("img")) + _T(".") + sImageExtension;
CImageFileFormatChecker checker;
std::wstring detectImageExtension = checker.DetectFormatByData(pDstBuffer, dstLen);
CFile oTempFile;
oTempFile.CreateFile(pathTemp.GetPath());
oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen);
oTempFile.CloseFile();
strUrl = strTempFile =pathTemp.GetPath(); // strTempFile для удаления
if (bBase64)
if (false == detectImageExtension.empty())
{
RELEASEARRAYOBJECTS(pDstBuffer);
if (sImageExtension.empty())
sImageExtension = detectImageExtension;
//папки media может не быть в случае, когда все картинки base64(поскольку файл временный, папку media не создаем)
std::wstring tempFilePath = pReader->m_strFolder + FILE_SEPARATOR_STR;
OOX::CPath pathTemp = NSFile::CFileBinary::CreateTempFileWithUniqueName(tempFilePath, _T("img")) + _T(".") + sImageExtension;
CFile oTempFile;
oTempFile.CreateFile(pathTemp.GetPath());
oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen);
oTempFile.CloseFile();
strUrl = strTempFile =pathTemp.GetPath(); // strTempFile для удаления
if (bBase64)
{
RELEASEARRAYOBJECTS(pDstBuffer);
}
}
else
{// бяка
strUrl.clear();
}
}
else
@ -521,6 +529,7 @@ namespace PPTX
pFill->tileRect = new PPTX::Logic::Rect();
pFill->tileRect->fromPPTY(pReader);
pFill->tileRect->m_name = _T("a:tileRect");
break;
}
default:
{

View File

@ -206,11 +206,16 @@ namespace PPTX
while (pReader->GetPos() < _e)
{
BYTE _rec = pReader->GetUChar();
Logic::UniColor color;
color.fromPPTY(pReader);
Scheme.insert(std::pair<std::wstring,Logic::UniColor>(SchemeClr_GetStringCode(_rec), color));
if (pReader->GetPos() + 4 < _e)
{
Logic::UniColor color;
color.fromPPTY(pReader);
Scheme.insert(std::pair<std::wstring,Logic::UniColor>(SchemeClr_GetStringCode(_rec), color));
}
else
break;
}
pReader->Seek(_e);

View File

@ -5,8 +5,8 @@
# iOS simulator.
#
# To configure the script, define:
# BOOST_VERSION: Which version of Boost to build (e.g. 1.58.0)
# BOOST_VERSION2: Same as BOOST_VERSION, but with _ instead of . (e.g. 1_58_0)
# BOOST_VERSION: Which version of Boost to build (e.g. 1.72.0)
# BOOST_VERSION2: Same as BOOST_VERSION, but with _ instead of . (e.g. 1_72_0)
# BOOST_LIBS: Which Boost libraries to build
# MIN_IOS_VERSION: Minimum iOS Target Version (e.g. 8.0)
# IOS_SDK_VERSION: iOS SDK version (e.g. 9.0)
@ -24,8 +24,8 @@ BOOST_LIBS="regex"
BUILD_IOS=
CLEAN=
BOOST_VERSION=1.58.0
BOOST_VERSION2=1_58_0
BOOST_VERSION=1.72.0
BOOST_VERSION2=1_72_0
MIN_IOS_VERSION=8.0
IOS_SDK_VERSION=`xcodebuild BITCODE_GENERATION_MODE="bitcode" ENABLE_BITCODE="YES" OTHER_CFLAGS="-fembed-bitcode" -showsdks | grep iphoneos | \
egrep "[[:digit:]]+\.[[:digit:]]+" -o | tail -1`

View File

@ -605,6 +605,7 @@ namespace OOX
case 'r':
if ( _T("v:rect") == sName )
m_oShape = oSubReader;
break;
case 's':
if ( _T("v:shadow") == sName )
pItem = new OOX::Vml::CShadow( oSubReader );

View File

@ -80,14 +80,15 @@ int download_external(const std::wstring& sUrl, const std::wstring& sOutput)
case 0: // child process
{
const char* nargs[7];
const char* nargs[8];
nargs[0] = "/usr/bin/curl";
nargs[1] = "--url";
nargs[2] = sUrlA.c_str();
nargs[3] = "--output";
nargs[4] = sOutputA.c_str();
nargs[5] = "--silent";
nargs[6] = NULL;
nargs[6] = "-L";
nargs[7] = NULL;
const char* nenv[3];
nenv[0] = "LD_PRELOAD=";

View File

@ -377,6 +377,7 @@ defineTest(ADD_DEPENDENCY) {
isEqual(lib, doctrenderer):CORE_BUILDS_LIBRARIES_PATH_DST=$$CORE_BUILDS_LIBRARIES_PATH/xp
isEqual(lib, ascdocumentscore):CORE_BUILDS_LIBRARIES_PATH_DST=$$CORE_BUILDS_LIBRARIES_PATH/xp
isEqual(lib, videoplayer):CORE_BUILDS_LIBRARIES_PATH_DST=$$CORE_BUILDS_LIBRARIES_PATH/xp
isEqual(lib, ooxmlsignature):CORE_BUILDS_LIBRARIES_PATH_DST=$$CORE_BUILDS_LIBRARIES_PATH/xp
}
!bundle_dylibs:LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH_DST -l$$lib
bundle_dylibs:LIBS += -F$$CORE_BUILDS_LIBRARIES_PATH_DST -framework $$lib

View File

@ -53,7 +53,9 @@ namespace BinXlsxRW {
long read1defstart_pos = m_oBufferedStream.GetPos();\
while(read1defCurPos < (long)stLen)\
{\
BYTE read1defType = m_oBufferedStream.GetUChar();\
BYTE read1defType = 0;\
if (false == m_oBufferedStream.GetUCharWithResult(&read1defType))\
break;\
ULONG read1defLength = m_oBufferedStream.GetULong();\
if (read1defLength + read1defCurPos > (ULONG)stLen)\
{\
@ -77,7 +79,9 @@ namespace BinXlsxRW {
long read2defCurPos = 0;\
while(read2defCurPos < stLen)\
{\
BYTE read2defType = m_oBufferedStream.GetUChar();\
BYTE read2defType = 0;\
if (false == m_oBufferedStream.GetUCharWithResult(&read2defType))\
break;\
long read2defLenType = m_oBufferedStream.GetUChar();\
int read2defCurPosShift = 2;\
int read2defRealLen;\

View File

@ -6789,7 +6789,11 @@ int BinaryFileReader::ReadMainTable(OOX::Spreadsheet::CXlsx& oXlsx, NSBinPptxRW:
res = oBufferedStream.Peek(5) == false ? c_oSerConstants::ErrorStream : c_oSerConstants::ReadOk;
if(c_oSerConstants::ReadOk != res)
return res;
BYTE mtiType = oBufferedStream.GetUChar();
BYTE mtiType = 0;
if (false == oBufferedStream.GetUCharWithResult(&mtiType))
break;
long mtiOffBits = oBufferedStream.GetLong();
if(c_oSerTableTypes::Other == mtiType)
nOtherOffBits = mtiOffBits;