From dc723a8da1d82e8b5edfbdfb06bd78648bdbacf6 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 21 Jul 2018 19:16:08 -0700 Subject: [PATCH] Fix strict aliasing violation --- app/backend/nvhttp.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/backend/nvhttp.cpp b/app/backend/nvhttp.cpp index a3d42af2..e2818d01 100644 --- a/app/backend/nvhttp.cpp +++ b/app/backend/nvhttp.cpp @@ -123,6 +123,11 @@ NvHTTP::launchApp(int appId, bool localAudio, int gamepadMask) { + int riKeyId; + + memcpy(&riKeyId, streamConfig->remoteInputAesIv, sizeof(riKeyId)); + riKeyId = qFromBigEndian(riKeyId); + QString response = openConnectionToString(m_BaseUrlHttps, "launch", @@ -132,7 +137,7 @@ NvHTTP::launchApp(int appId, QString::number(streamConfig->fps)+ "&additionalStates=1&sops="+QString::number(sops ? 1 : 0)+ "&rikey="+QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex()+ - "&rikeyid="+QString::number(qFromBigEndian(*(int*)streamConfig->remoteInputAesIv))+ + "&rikeyid="+QString::number(riKeyId)+ (streamConfig->enableHdr ? "&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0" : "")+ @@ -149,11 +154,16 @@ NvHTTP::launchApp(int appId, void NvHTTP::resumeApp(PSTREAM_CONFIGURATION streamConfig) { + int riKeyId; + + memcpy(&riKeyId, streamConfig->remoteInputAesIv, sizeof(riKeyId)); + riKeyId = qFromBigEndian(riKeyId); + QString response = openConnectionToString(m_BaseUrlHttps, "resume", "rikey="+QString(QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex())+ - "&rikeyid="+QString::number(qFromBigEndian(*(int*)streamConfig->remoteInputAesIv))+ + "&rikeyid="+QString::number(riKeyId)+ "&surroundAudioInfo="+getSurroundAudioInfoString(streamConfig->audioConfiguration), false);