已合并
fix ashmem fd container residue in unmarshal thread and enhance marshalling failure logs #31901
LyBbq创建于 8月3日
fix ashmem fd container residue in unmarshal thread and enhance marshalling failure logs #31901
已合并
共 5 个文件变更+68-7
| @@ -270,6 +270,8 @@ void RSClientToRenderConnection::RSApplicationRenderThreadDeathRecipient::OnRemo | |||
| 270 | ErrCode RSClientToRenderConnection::CommitTransaction(std::unique_ptr<RSTransactionData>& transactionData) | 270 | ErrCode RSClientToRenderConnection::CommitTransaction(std::unique_ptr<RSTransactionData>& transactionData) |
| 271 | { | 271 | { |
| 272 | if (renderPipelineAgent_ == nullptr) { | 272 | if (renderPipelineAgent_ == nullptr) { |
| 273 | + RS_LOGE("RSClientToRenderConnection::CommitTransaction renderPipelineAgent_ is null, " | ||
| 274 | + "transaction dropped, hasData:%{public}d", transactionData != nullptr); | ||
| 273 | return ERR_INVALID_VALUE; | 275 | return ERR_INVALID_VALUE; |
| 274 | } | 276 | } |
| 275 | pid_t callingPid = GetCallingPid(); | 277 | pid_t callingPid = GetCallingPid(); |
| @@ -138,6 +138,7 @@ void RSUnmarshalThread::RecvParcel(std::shared_ptr<MessageParcel>& parcel, bool | |||
| 138 | ashmemFdWorker = std::shared_ptr(std::move(ashmemFdWorker)), ashmemFlowControlUnit, parcelNumber]() mutable { | 138 | ashmemFdWorker = std::shared_ptr(std::move(ashmemFdWorker)), ashmemFlowControlUnit, parcelNumber]() mutable { |
| 139 | RSMarshallingHelper::SetCallingPid(callingPid); | 139 | RSMarshallingHelper::SetCallingPid(callingPid); |
| 140 | AshmemFdContainer::SetIsUnmarshalThread(true); | 140 | AshmemFdContainer::SetIsUnmarshalThread(true); |
| 141 | + AshmemFdContainer::Instance().Clear(); | ||
| 141 | if (ashmemFdWorker) { | 142 | if (ashmemFdWorker) { |
| 142 | ashmemFdWorker->PushFdsToContainer(); | 143 | ashmemFdWorker->PushFdsToContainer(); |
| 143 | } | 144 | } |
| @@ -67,13 +67,12 @@ public: | |||
| 67 | ~AshmemFdContainer() = default; | 67 | ~AshmemFdContainer() = default; |
| 68 | static void SetIsUnmarshalThread(bool isUnmarshalThread); | 68 | static void SetIsUnmarshalThread(bool isUnmarshalThread); |
| 69 | int ReadSafeFd(Parcel& parcel, std::function<int(Parcel&)> readFdDefaultFunc = nullptr); | 69 | int ReadSafeFd(Parcel& parcel, std::function<int(Parcel&)> readFdDefaultFunc = nullptr); |
| 70 | - | 70 | + void Clear(); |
| 71 | private: | 71 | private: |
| 72 | AshmemFdContainer() = default; | 72 | AshmemFdContainer() = default; |
| 73 | DISALLOW_COPY_AND_MOVE(AshmemFdContainer); | 73 | DISALLOW_COPY_AND_MOVE(AshmemFdContainer); |
| 74 | 74 | ||
| 75 | void Merge(const std::unordered_map<binder_size_t, int>& fds); | 75 | void Merge(const std::unordered_map<binder_size_t, int>& fds); |
| 76 | - void Clear(); | ||
| 77 | std::string PrintFds() const; | 76 | std::string PrintFds() const; |
| 78 | 77 | ||
| 79 | std::unordered_map<binder_size_t, int> fds_; | 78 | std::unordered_map<binder_size_t, int> fds_; |
| @@ -227,6 +227,8 @@ bool AshmemAllocator::Seal() | |||
| 227 | bool AshmemAllocator::WriteToAshmem(const void *data, size_t size) | 227 | bool AshmemAllocator::WriteToAshmem(const void *data, size_t size) |
| 228 | { | 228 | { |
| 229 | if (data == nullptr || size_ < size) { | 229 | if (data == nullptr || size_ < size) { |
| 230 | + ROSEN_LOGE("AshmemAllocator::WriteToAshmem invalid param, data null:%{public}d, " | ||
| 231 | + "size_:%{public}zu, size:%{public}zu", data == nullptr, size_, size); | ||
| 230 | return false; | 232 | return false; |
| 231 | } | 233 | } |
| 232 | if (!data_) { | 234 | if (!data_) { |
| @@ -244,6 +246,7 @@ bool AshmemAllocator::WriteToAshmem(const void *data, size_t size) | |||
| 244 | void* AshmemAllocator::CopyFromAshmem(size_t size) | 246 | void* AshmemAllocator::CopyFromAshmem(size_t size) |
| 245 | { | 247 | { |
| 246 | if (size_ < size) { | 248 | if (size_ < size) { |
| 249 | + ROSEN_LOGE("AshmemAllocator::CopyFromAshmem size_:%{public}zu < size:%{public}zu", size_, size); | ||
| 247 | return nullptr; | 250 | return nullptr; |
| 248 | } | 251 | } |
| 249 | if (size > LARGE_MALLOC) { | 252 | if (size > LARGE_MALLOC) { |
| @@ -553,14 +556,20 @@ std::shared_ptr<MessageParcel> RSAshmemHelper::CreateAshmemParcel(std::shared_pt | |||
| 553 | // 1. save data | 556 | // 1. save data |
| 554 | int fd = ashmemAllocator->GetFd(); | 557 | int fd = ashmemAllocator->GetFd(); |
| 555 | std::shared_ptr<MessageParcel> ashmemParcel = std::make_shared<MessageParcel>(); | 558 | std::shared_ptr<MessageParcel> ashmemParcel = std::make_shared<MessageParcel>(); |
| 556 | - ashmemParcel->WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor()); | 559 | + // 1: indicate ashmem parcel |
| 557 | - ashmemParcel->WriteInt32(1); // 1: indicate ashmem parcel | 560 | + if (!ashmemParcel->WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor()) || |
| 558 | - ashmemParcel->WriteUint32(dataSize); | 561 | + !ashmemParcel->WriteInt32(1) || !ashmemParcel->WriteUint32(dataSize) || |
| 559 | - ashmemParcel->WriteFileDescriptor(fd); | 562 | + !ashmemParcel->WriteFileDescriptor(fd)) { |
| 563 | + ROSEN_LOGE("CreateAshmemParcel: write ashmem header failed, dataSize:%{public}zu", dataSize); | ||
| 564 | + return nullptr; | ||
| 565 | + } | ||
| 560 | 566 | ||
| 561 | // 2. save fds and their offsets | 567 | // 2. save fds and their offsets |
| 562 | size_t offsetSize = dataParcel->GetOffsetsSize(); | 568 | size_t offsetSize = dataParcel->GetOffsetsSize(); |
| 563 | - ashmemParcel->WriteInt32(offsetSize); | 569 | + if (!ashmemParcel->WriteInt32(offsetSize)) { |
| 570 | + ROSEN_LOGE("CreateAshmemParcel: WriteInt32 offsetSize failed"); | ||
| 571 | + return nullptr; | ||
| 572 | + } | ||
| 564 | if (offsetSize > 0) { | 573 | if (offsetSize > 0) { |
| 565 | // save array that record the offsets of all fds | 574 | // save array that record the offsets of all fds |
| 566 | ashmemParcel->WriteBuffer( | 575 | ashmemParcel->WriteBuffer( |
| @@ -656,6 +665,7 @@ std::shared_ptr<MessageParcel> RSAshmemHelper::ParseFromAshmemParcel(MessageParc | |||
| 656 | 665 | ||
| 657 | auto token = dataParcel->ReadInterfaceToken(); | 666 | auto token = dataParcel->ReadInterfaceToken(); |
| 658 | if (token != RSIClientToRenderConnection::GetDescriptor()) { | 667 | if (token != RSIClientToRenderConnection::GetDescriptor()) { |
| 668 | + ROSEN_LOGE("RSAshmemHelper::ParseFromAshmemParcel interface token mismatch"); | ||
| 659 | return nullptr; | 669 | return nullptr; |
| 660 | } | 670 | } |
| 661 | 671 | ||
| @@ -194,6 +194,8 @@ static bool MarshallingRecordCmdFromDrawCmdList(Parcel& parcel, const std::share | |||
| 194 | } | 194 | } |
| 195 | for (const auto& recordCmd : recordCmdVec) { | 195 | for (const auto& recordCmd : recordCmdVec) { |
| 196 | if (!RSMarshallingHelper::Marshalling(parcel, recordCmd, recordCmdDepth)) { | 196 | if (!RSMarshallingHelper::Marshalling(parcel, recordCmd, recordCmdDepth)) { |
| 197 | + ROSEN_LOGE("unirender: RSMarshallingHelper::MarshallingRecordCmdFromDrawCmdList " | ||
| 198 | + "failed to marshal recordCmd"); | ||
| 197 | return false; | 199 | return false; |
| 198 | } | 200 | } |
| 199 | } | 201 | } |
| @@ -224,6 +226,8 @@ static bool UnmarshallingRecordCmdToDrawCmdList(Parcel& parcel, std::shared_ptr< | |||
| 224 | } | 226 | } |
| 225 | std::shared_ptr<Drawing::RecordCmd> recordCmd = nullptr; | 227 | std::shared_ptr<Drawing::RecordCmd> recordCmd = nullptr; |
| 226 | if (!RSMarshallingHelper::Unmarshalling(parcel, recordCmd, opItemCount, recordCmdCount, recordCmdDepth)) { | 228 | if (!RSMarshallingHelper::Unmarshalling(parcel, recordCmd, opItemCount, recordCmdCount, recordCmdDepth)) { |
| 229 | + ROSEN_LOGE("unirender: RSMarshallingHelper::UnmarshallingRecordCmdToDrawCmdList " | ||
| 230 | + "failed to unmarshal recordCmd at index[%{public}u]", i); | ||
| 227 | return false; | 231 | return false; |
| 228 | } | 232 | } |
| 229 | recordCmdVec.emplace_back(recordCmd); | 233 | recordCmdVec.emplace_back(recordCmd); |
| @@ -252,6 +256,8 @@ bool MarshallingExtendObjectFromDrawCmdList(Parcel& parcel, const std::shared_pt | |||
| 252 | } | 256 | } |
| 253 | for (const auto& object : objectVec) { | 257 | for (const auto& object : objectVec) { |
| 254 | if (!object->Marshalling(parcel)) { | 258 | if (!object->Marshalling(parcel)) { |
| 259 | + ROSEN_LOGE("unirender: RSMarshallingHelper::MarshallingExtendObjectFromDrawCmdList " | ||
| 260 | + "failed to marshal extend object"); | ||
| 255 | return false; | 261 | return false; |
| 256 | } | 262 | } |
| 257 | } | 263 | } |
| @@ -276,6 +282,8 @@ bool UnmarshallingExtendObjectToDrawCmdList(Parcel& parcel, std::shared_ptr<Draw | |||
| 276 | for (uint32_t i = 0; i < objectSize; i++) { | 282 | for (uint32_t i = 0; i < objectSize; i++) { |
| 277 | std::shared_ptr<RSPixelMapShader> object = std::make_shared<RSPixelMapShader>(); | 283 | std::shared_ptr<RSPixelMapShader> object = std::make_shared<RSPixelMapShader>(); |
| 278 | if (!object->Unmarshalling(parcel)) { | 284 | if (!object->Unmarshalling(parcel)) { |
| 285 | + ROSEN_LOGE("unirender: RSMarshallingHelper::UnmarshallingExtendObjectToDrawCmdList " | ||
| 286 | + "failed to unmarshal extend object at index[%{public}u]", i); | ||
| 279 | return false; | 287 | return false; |
| 280 | } | 288 | } |
| 281 | objectVec.emplace_back(object); | 289 | objectVec.emplace_back(object); |
| @@ -851,6 +859,7 @@ bool RSMarshallingHelper::UnmarshallingNoLazyGeneratedImage(Parcel& parcel, | |||
| 851 | auto colorSpace = std::make_shared<Drawing::ColorSpace>(Drawing::ColorSpace::ColorSpaceType::NO_TYPE); | 859 | auto colorSpace = std::make_shared<Drawing::ColorSpace>(Drawing::ColorSpace::ColorSpaceType::NO_TYPE); |
| 852 | 860 | ||
| 853 | if (!ReadColorSpaceFromParcel(parcel, colorSpace)) { | 861 | if (!ReadColorSpaceFromParcel(parcel, colorSpace)) { |
| 862 | + ROSEN_LOGE("RSMarshallingHelper::UnmarshallingNoLazyGeneratedImage ReadColorSpaceFromParcel failed"); | ||
| 854 | if (isMalloc) { | 863 | if (isMalloc) { |
| 855 | free(const_cast<void*>(addr)); | 864 | free(const_cast<void*>(addr)); |
| 856 | addr = nullptr; | 865 | addr = nullptr; |
| @@ -1058,6 +1067,8 @@ bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, std::shared_ptr<RSLinear | |||
| 1058 | return false; | 1067 | return false; |
| 1059 | } | 1068 | } |
| 1060 | if (fractionStopsSize > SIZE_UPPER_LIMIT) { | 1069 | if (fractionStopsSize > SIZE_UPPER_LIMIT) { |
| 1070 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling RSLinearGradientBlurPara fractionStopsSize " | ||
| 1071 | + "%{public}u exceeds limit", fractionStopsSize); | ||
| 1061 | return false; | 1072 | return false; |
| 1062 | } | 1073 | } |
| 1063 | for (size_t i = 0; i < fractionStopsSize; i++) { | 1074 | for (size_t i = 0; i < fractionStopsSize; i++) { |
| @@ -1066,11 +1077,15 @@ bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, std::shared_ptr<RSLinear | |||
| 1066 | float second = 0.0; | 1077 | float second = 0.0; |
| 1067 | success &= Unmarshalling(parcel, first); | 1078 | success &= Unmarshalling(parcel, first); |
| 1068 | if (!success) { | 1079 | if (!success) { |
| 1080 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling RSLinearGradientBlurPara read first failed " | ||
| 1081 | + "at index[%{public}zu]", i); | ||
| 1069 | return false; | 1082 | return false; |
| 1070 | } | 1083 | } |
| 1071 | fractionStop.first = first; | 1084 | fractionStop.first = first; |
| 1072 | success &= Unmarshalling(parcel, second); | 1085 | success &= Unmarshalling(parcel, second); |
| 1073 | if (!success) { | 1086 | if (!success) { |
| 1087 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling RSLinearGradientBlurPara read second failed " | ||
| 1088 | + "at index[%{public}zu]", i); | ||
| 1074 | return false; | 1089 | return false; |
| 1075 | } | 1090 | } |
| 1076 | fractionStop.second = second; | 1091 | fractionStop.second = second; |
| @@ -1118,6 +1133,7 @@ bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, std::shared_ptr<MotionBl | |||
| 1118 | bool RSMarshallingHelper::Marshalling(Parcel& parcel, const std::shared_ptr<AnnulusRegion>& val) | 1133 | bool RSMarshallingHelper::Marshalling(Parcel& parcel, const std::shared_ptr<AnnulusRegion>& val) |
| 1119 | { | 1134 | { |
| 1120 | if (!val) { | 1135 | if (!val) { |
| 1136 | + ROSEN_LOGE("RSMarshallingHelper::Marshalling AnnulusRegion val is null"); | ||
| 1121 | return false; | 1137 | return false; |
| 1122 | } | 1138 | } |
| 1123 | return Marshalling(parcel, val->center_.x_) && Marshalling(parcel, val->center_.y_) && | 1139 | return Marshalling(parcel, val->center_.x_) && Marshalling(parcel, val->center_.y_) && |
| @@ -1250,6 +1266,8 @@ bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, std::vector<std::shared_ | |||
| 1250 | bool success = true; | 1266 | bool success = true; |
| 1251 | std::vector<std::shared_ptr<EmitterUpdater>> emitterUpdaters; | 1267 | std::vector<std::shared_ptr<EmitterUpdater>> emitterUpdaters; |
| 1252 | if (size > PARTICLE_EMMITER_UPPER_LIMIT) { | 1268 | if (size > PARTICLE_EMMITER_UPPER_LIMIT) { |
| 1269 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling EmitterUpdater size " | ||
| 1270 | + "%{public}u exceeds limit %{public}u", size, PARTICLE_EMMITER_UPPER_LIMIT); | ||
| 1253 | return false; | 1271 | return false; |
| 1254 | } | 1272 | } |
| 1255 | for (size_t i = 0; i < size; i++) { | 1273 | for (size_t i = 0; i < size; i++) { |
| @@ -1503,6 +1521,8 @@ bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, std::shared_ptr<Particle | |||
| 1503 | } | 1521 | } |
| 1504 | bool success = true; | 1522 | bool success = true; |
| 1505 | if (size > PARTICLE_EMMITER_UPPER_LIMIT) { | 1523 | if (size > PARTICLE_EMMITER_UPPER_LIMIT) { |
| 1524 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling ParticleNoiseFields size " | ||
| 1525 | + "%{public}u exceeds limit %{public}u", size, PARTICLE_EMMITER_UPPER_LIMIT); | ||
| 1506 | return false; | 1526 | return false; |
| 1507 | } | 1527 | } |
| 1508 | std::shared_ptr<ParticleNoiseFields> noiseFields = std::make_shared<ParticleNoiseFields>(); | 1528 | std::shared_ptr<ParticleNoiseFields> noiseFields = std::make_shared<ParticleNoiseFields>(); |
| @@ -1798,6 +1818,8 @@ bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, RenderParticleParaType<f | |||
| 1798 | return false; | 1818 | return false; |
| 1799 | } | 1819 | } |
| 1800 | if (valChangeOverLifeSize > SIZE_UPPER_LIMIT) { | 1820 | if (valChangeOverLifeSize > SIZE_UPPER_LIMIT) { |
| 1821 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling RenderParticleParaType valChangeOverLifeSize " | ||
| 1822 | + "%{public}u exceeds limit", valChangeOverLifeSize); | ||
| 1801 | return false; | 1823 | return false; |
| 1802 | } | 1824 | } |
| 1803 | for (size_t i = 0; i < valChangeOverLifeSize; i++) { | 1825 | for (size_t i = 0; i < valChangeOverLifeSize; i++) { |
| @@ -1882,6 +1904,8 @@ bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, RenderParticleColorParaT | |||
| 1882 | return false; | 1904 | return false; |
| 1883 | } | 1905 | } |
| 1884 | if (valChangeOverLifeSize > SIZE_UPPER_LIMIT) { | 1906 | if (valChangeOverLifeSize > SIZE_UPPER_LIMIT) { |
| 1907 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling RenderParticleColorParaType valChangeOverLifeSize " | ||
| 1908 | + "%{public}u exceeds limit", valChangeOverLifeSize); | ||
| 1885 | return false; | 1909 | return false; |
| 1886 | } | 1910 | } |
| 1887 | for (size_t i = 0; i < valChangeOverLifeSize; i++) { | 1911 | for (size_t i = 0; i < valChangeOverLifeSize; i++) { |
| @@ -1991,6 +2015,8 @@ bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, std::vector<std::shared_ | |||
| 1991 | bool success = true; | 2015 | bool success = true; |
| 1992 | std::vector<std::shared_ptr<ParticleRenderParams>> particlesRenderParams; | 2016 | std::vector<std::shared_ptr<ParticleRenderParams>> particlesRenderParams; |
| 1993 | if (size > PARTICLE_EMMITER_UPPER_LIMIT) { | 2017 | if (size > PARTICLE_EMMITER_UPPER_LIMIT) { |
| 2018 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling ParticleRenderParams size " | ||
| 2019 | + "%{public}u exceeds limit %{public}u", size, PARTICLE_EMMITER_UPPER_LIMIT); | ||
| 1994 | return false; | 2020 | return false; |
| 1995 | } | 2021 | } |
| 1996 | for (size_t i = 0; i < size; i++) { | 2022 | for (size_t i = 0; i < size; i++) { |
| @@ -2724,6 +2750,8 @@ bool RSMarshallingHelper::SafeUnmarshallingDrawCmdList(Parcel& parcel, std::shar | |||
| 2724 | } | 2750 | } |
| 2725 | if (objectSize > 0) { | 2751 | if (objectSize > 0) { |
| 2726 | if (objectSize > Drawing::MAX_OPITEMSIZE) { | 2752 | if (objectSize > Drawing::MAX_OPITEMSIZE) { |
| 2753 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling DrawCmdList objectSize " | ||
| 2754 | + "%{public}u exceeds limit", objectSize); | ||
| 2727 | return false; | 2755 | return false; |
| 2728 | } | 2756 | } |
| 2729 | std::vector<std::shared_ptr<Drawing::ExtendImageObject>> imageObjectVec; | 2757 | std::vector<std::shared_ptr<Drawing::ExtendImageObject>> imageObjectVec; |
| @@ -2747,6 +2775,8 @@ bool RSMarshallingHelper::SafeUnmarshallingDrawCmdList(Parcel& parcel, std::shar | |||
| 2747 | } | 2775 | } |
| 2748 | if (objectBaseSize > 0) { | 2776 | if (objectBaseSize > 0) { |
| 2749 | if (objectBaseSize > Drawing::MAX_OPITEMSIZE) { | 2777 | if (objectBaseSize > Drawing::MAX_OPITEMSIZE) { |
| 2778 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling DrawCmdList objectBaseSize " | ||
| 2779 | + "%{public}u exceeds limit", objectBaseSize); | ||
| 2750 | return false; | 2780 | return false; |
| 2751 | } | 2781 | } |
| 2752 | std::vector<std::shared_ptr<Drawing::ExtendImageBaseObj>> ObjectBaseVec; | 2782 | std::vector<std::shared_ptr<Drawing::ExtendImageBaseObj>> ObjectBaseVec; |
| @@ -2770,6 +2800,8 @@ bool RSMarshallingHelper::SafeUnmarshallingDrawCmdList(Parcel& parcel, std::shar | |||
| 2770 | } | 2800 | } |
| 2771 | if (objectNineSize > 0) { | 2801 | if (objectNineSize > 0) { |
| 2772 | if (objectNineSize > Drawing::MAX_OPITEMSIZE) { | 2802 | if (objectNineSize > Drawing::MAX_OPITEMSIZE) { |
| 2803 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling DrawCmdList objectNineSize " | ||
| 2804 | + "%{public}u exceeds limit", objectNineSize); | ||
| 2773 | return false; | 2805 | return false; |
| 2774 | } | 2806 | } |
| 2775 | std::vector<std::shared_ptr<Drawing::ExtendImageNineObject>> ObjectNineVec; | 2807 | std::vector<std::shared_ptr<Drawing::ExtendImageNineObject>> ObjectNineVec; |
| @@ -2793,6 +2825,8 @@ bool RSMarshallingHelper::SafeUnmarshallingDrawCmdList(Parcel& parcel, std::shar | |||
| 2793 | } | 2825 | } |
| 2794 | if (objectLatticeSize > 0) { | 2826 | if (objectLatticeSize > 0) { |
| 2795 | if (objectLatticeSize > Drawing::MAX_OPITEMSIZE) { | 2827 | if (objectLatticeSize > Drawing::MAX_OPITEMSIZE) { |
| 2828 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling DrawCmdList objectLatticeSize " | ||
| 2829 | + "%{public}u exceeds limit", objectLatticeSize); | ||
| 2796 | return false; | 2830 | return false; |
| 2797 | } | 2831 | } |
| 2798 | std::vector<std::shared_ptr<Drawing::ExtendImageLatticeObject>> ObjectLatticeVec; | 2832 | std::vector<std::shared_ptr<Drawing::ExtendImageLatticeObject>> ObjectLatticeVec; |
| @@ -2829,6 +2863,8 @@ bool RSMarshallingHelper::SafeUnmarshallingDrawCmdList(Parcel& parcel, std::shar | |||
| 2829 | } | 2863 | } |
| 2830 | if (surfaceBufferEntrySize > 0) { | 2864 | if (surfaceBufferEntrySize > 0) { |
| 2831 | if (surfaceBufferEntrySize > Drawing::MAX_OPITEMSIZE) { | 2865 | if (surfaceBufferEntrySize > Drawing::MAX_OPITEMSIZE) { |
| 2866 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling DrawCmdList surfaceBufferEntrySize " | ||
| 2867 | + "%{public}u exceeds limit", surfaceBufferEntrySize); | ||
| 2832 | return false; | 2868 | return false; |
| 2833 | } | 2869 | } |
| 2834 | uint32_t surfaceBufferEntrySizeInBytes = 0; | 2870 | uint32_t surfaceBufferEntrySizeInBytes = 0; |
| @@ -2888,6 +2924,8 @@ bool RSMarshallingHelper::SafeUnmarshallingDrawCmdList(Parcel& parcel, std::shar | |||
| 2888 | val->SetIsReplayMode(RS_PROFILER_IS_PARCEL_MOCK(parcel)); | 2924 | val->SetIsReplayMode(RS_PROFILER_IS_PARCEL_MOCK(parcel)); |
| 2889 | val->UnmarshallingDrawOps(opItemCount); | 2925 | val->UnmarshallingDrawOps(opItemCount); |
| 2890 | if (opItemCount && (*opItemCount) > Drawing::MAX_OPITEMSIZE) { | 2926 | if (opItemCount && (*opItemCount) > Drawing::MAX_OPITEMSIZE) { |
| 2927 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling DrawCmdList opItemCount " | ||
| 2928 | + "%{public}u exceeds limit", *opItemCount); | ||
| 2891 | return false; | 2929 | return false; |
| 2892 | } | 2930 | } |
| 2893 | return true; | 2931 | return true; |
| @@ -3446,6 +3484,7 @@ bool RSMarshallingHelper::WriteToParcel(Parcel& parcel, const void* data, size_t | |||
| 3446 | } | 3484 | } |
| 3447 | if (size < MIN_DATA_SIZE || (!g_useSharedMem && g_tid == std::this_thread::get_id())) { | 3485 | if (size < MIN_DATA_SIZE || (!g_useSharedMem && g_tid == std::this_thread::get_id())) { |
| 3448 | if (!parcel.WriteUnpadBuffer(data, size)) { | 3486 | if (!parcel.WriteUnpadBuffer(data, size)) { |
| 3487 | + ROSEN_LOGE("RSMarshallingHelper::WriteToParcel WriteUnpadBuffer failed, size:%{public}zu", size); | ||
| 3449 | return false; | 3488 | return false; |
| 3450 | } | 3489 | } |
| 3451 | return true; | 3490 | return true; |
| @@ -3746,9 +3785,11 @@ bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, RSRenderParticleVector& | |||
| 3746 | bool RSMarshallingHelper::Marshalling(Parcel& parcel, const SurfaceRegionConfig& val) | 3785 | bool RSMarshallingHelper::Marshalling(Parcel& parcel, const SurfaceRegionConfig& val) |
| 3747 | { | 3786 | { |
| 3748 | if (!Marshalling(parcel, val.surface)) { | 3787 | if (!Marshalling(parcel, val.surface)) { |
| 3788 | + ROSEN_LOGE("RSMarshallingHelper::Marshalling SurfaceRegionConfig surface failed"); | ||
| 3749 | return false; | 3789 | return false; |
| 3750 | } | 3790 | } |
| 3751 | if (!Marshalling(parcel, val.region)) { | 3791 | if (!Marshalling(parcel, val.region)) { |
| 3792 | + ROSEN_LOGE("RSMarshallingHelper::Marshalling SurfaceRegionConfig region failed"); | ||
| 3752 | return false; | 3793 | return false; |
| 3753 | } | 3794 | } |
| 3754 | return true; | 3795 | return true; |
| @@ -3757,9 +3798,11 @@ bool RSMarshallingHelper::Marshalling(Parcel& parcel, const SurfaceRegionConfig& | |||
| 3757 | bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, SurfaceRegionConfig& val) | 3798 | bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, SurfaceRegionConfig& val) |
| 3758 | { | 3799 | { |
| 3759 | if (!Unmarshalling(parcel, val.surface)) { | 3800 | if (!Unmarshalling(parcel, val.surface)) { |
| 3801 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling SurfaceRegionConfig surface failed"); | ||
| 3760 | return false; | 3802 | return false; |
| 3761 | } | 3803 | } |
| 3762 | if (!Unmarshalling(parcel, val.region)) { | 3804 | if (!Unmarshalling(parcel, val.region)) { |
| 3805 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling SurfaceRegionConfig region failed"); | ||
| 3763 | return false; | 3806 | return false; |
| 3764 | } | 3807 | } |
| 3765 | return true; | 3808 | return true; |
| @@ -3795,18 +3838,22 @@ bool RSMarshallingHelper::Marshalling(Parcel& parcel, sptr<Surface> surface) | |||
| 3795 | auto producer = surface->GetProducer(); | 3838 | auto producer = surface->GetProducer(); |
| 3796 | if (producer != nullptr) { | 3839 | if (producer != nullptr) { |
| 3797 | if (!parcel.WriteBool(true)) { | 3840 | if (!parcel.WriteBool(true)) { |
| 3841 | + ROSEN_LOGE("RSMarshallingHelper::Marshalling Surface WriteBool failed"); | ||
| 3798 | return false; | 3842 | return false; |
| 3799 | } | 3843 | } |
| 3800 | if (!parcel.WriteRemoteObject(producer->AsObject())) { | 3844 | if (!parcel.WriteRemoteObject(producer->AsObject())) { |
| 3845 | + ROSEN_LOGE("RSMarshallingHelper::Marshalling Surface WriteRemoteObject failed"); | ||
| 3801 | return false; | 3846 | return false; |
| 3802 | } | 3847 | } |
| 3803 | } else { | 3848 | } else { |
| 3804 | if (!parcel.WriteBool(false)) { | 3849 | if (!parcel.WriteBool(false)) { |
| 3850 | + ROSEN_LOGE("RSMarshallingHelper::Marshalling Surface WriteBool false failed"); | ||
| 3805 | return false; | 3851 | return false; |
| 3806 | } | 3852 | } |
| 3807 | } | 3853 | } |
| 3808 | } else { | 3854 | } else { |
| 3809 | if (!parcel.WriteBool(false)) { | 3855 | if (!parcel.WriteBool(false)) { |
| 3856 | + ROSEN_LOGE("RSMarshallingHelper::Marshalling Surface WriteBool false for null failed"); | ||
| 3810 | return false; | 3857 | return false; |
| 3811 | } | 3858 | } |
| 3812 | } | 3859 | } |
| @@ -3818,11 +3865,13 @@ bool RSMarshallingHelper::Unmarshalling(Parcel& parcel, sptr<Surface>& surface) | |||
| 3818 | surface = nullptr; | 3865 | surface = nullptr; |
| 3819 | bool hasSurface { false }; | 3866 | bool hasSurface { false }; |
| 3820 | if (!parcel.ReadBool(hasSurface)) { | 3867 | if (!parcel.ReadBool(hasSurface)) { |
| 3868 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling Surface ReadBool failed"); | ||
| 3821 | return false; | 3869 | return false; |
| 3822 | } | 3870 | } |
| 3823 | if (hasSurface) { | 3871 | if (hasSurface) { |
| 3824 | auto remoteObject = static_cast<MessageParcel*>(&parcel)->ReadRemoteObject(); | 3872 | auto remoteObject = static_cast<MessageParcel*>(&parcel)->ReadRemoteObject(); |
| 3825 | if (remoteObject == nullptr) { | 3873 | if (remoteObject == nullptr) { |
| 3874 | + ROSEN_LOGE("RSMarshallingHelper::Unmarshalling Surface ReadRemoteObject failed"); | ||
| 3826 | return false; | 3875 | return false; |
| 3827 | } | 3876 | } |
| 3828 | auto bufferProducer = iface_cast<IBufferProducer>(remoteObject); | 3877 | auto bufferProducer = iface_cast<IBufferProducer>(remoteObject); |