forked from suyu/suyu
Fixed uninitialized memory due to missing returns in canary
Functions which are suppose to crash on non canary builds usually don't return anything which lead to uninitialized memory being used.
This commit is contained in:
parent
39262921f2
commit
fdd649e2ef
14 changed files with 33 additions and 3 deletions
|
@ -128,6 +128,7 @@ std::string SaveDataFactory::GetFullPath(SaveDataSpaceId space, SaveDataType typ
|
||||||
return fmt::format("{}save/cache/{:016X}", out, title_id);
|
return fmt::format("{}save/cache/{:016X}", out, title_id);
|
||||||
default:
|
default:
|
||||||
ASSERT_MSG(false, "Unrecognized SaveDataType: {:02X}", static_cast<u8>(type));
|
ASSERT_MSG(false, "Unrecognized SaveDataType: {:02X}", static_cast<u8>(type));
|
||||||
|
return fmt::format("{}save/unknown_{:X}/{:016X}", out, static_cast<u8>(type), title_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ bool Object::IsWaitable() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
|
@ -187,6 +187,7 @@ T Read(const VAddr vaddr) {
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -164,6 +164,7 @@ public:
|
||||||
return 3;
|
return 3;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -871,6 +872,7 @@ public:
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUVAddr StartAddress() const {
|
GPUVAddr StartAddress() const {
|
||||||
|
|
|
@ -1065,6 +1065,7 @@ union Instruction {
|
||||||
LOG_CRITICAL(HW_GPU, "Unhandled texture_info: {}",
|
LOG_CRITICAL(HW_GPU, "Unhandled texture_info: {}",
|
||||||
static_cast<u32>(texture_info.Value()));
|
static_cast<u32>(texture_info.Value()));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return TextureType::Texture1D;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureProcessMode GetTextureProcessMode() const {
|
TextureProcessMode GetTextureProcessMode() const {
|
||||||
|
@ -1145,6 +1146,7 @@ union Instruction {
|
||||||
LOG_CRITICAL(HW_GPU, "Unhandled texture_info: {}",
|
LOG_CRITICAL(HW_GPU, "Unhandled texture_info: {}",
|
||||||
static_cast<u32>(texture_info.Value()));
|
static_cast<u32>(texture_info.Value()));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return TextureType::Texture1D;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureProcessMode GetTextureProcessMode() const {
|
TextureProcessMode GetTextureProcessMode() const {
|
||||||
|
|
|
@ -102,6 +102,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format));
|
UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format));
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +120,7 @@ u32 DepthFormatBytesPerPixel(DepthFormat format) {
|
||||||
return 2;
|
return 2;
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_MSG("Unimplemented Depth format {}", static_cast<u32>(format));
|
UNIMPLEMENTED_MSG("Unimplemented Depth format {}", static_cast<u32>(format));
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,6 +171,7 @@ u32 MacroInterpreter::GetALUResult(ALUOperation operation, u32 src_a, u32 src_b)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ALU operation {}", static_cast<u32>(operation));
|
UNIMPLEMENTED_MSG("Unimplemented ALU operation {}", static_cast<u32>(operation));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,6 +269,7 @@ bool MacroInterpreter::EvaluateBranchCondition(BranchCondition cond, u32 value)
|
||||||
return value != 0;
|
return value != 0;
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Tegra
|
} // namespace Tegra
|
||||||
|
|
|
@ -192,6 +192,7 @@ static MortonCopyFn GetSwizzleFunction(MortonSwizzleMode mode, Surface::PixelFor
|
||||||
return linear_to_morton_fns[static_cast<std::size_t>(format)];
|
return linear_to_morton_fns[static_cast<std::size_t>(format)];
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return morton_to_linear_fns[static_cast<std::size_t>(format)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 8x8 Z-Order coordinate from 2D coordinates
|
/// 8x8 Z-Order coordinate from 2D coordinates
|
||||||
|
|
|
@ -67,6 +67,7 @@ public:
|
||||||
6, "ShaderTrianglesAdjacency");
|
6, "ShaderTrianglesAdjacency");
|
||||||
default:
|
default:
|
||||||
UNREACHABLE_MSG("Unknown primitive mode.");
|
UNREACHABLE_MSG("Unknown primitive mode.");
|
||||||
|
return LazyGeometryProgram(geometry_programs.points, "points", 1, "ShaderPoints");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,6 +364,7 @@ public:
|
||||||
return value;
|
return value;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE_MSG("Unimplemented conversion size: {}", static_cast<u32>(size));
|
UNREACHABLE_MSG("Unimplemented conversion size: {}", static_cast<u32>(size));
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,6 +627,7 @@ public:
|
||||||
return "floatBitsToInt(" + value + ')';
|
return "floatBitsToInt(" + value + ')';
|
||||||
} else {
|
} else {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2064,6 +2066,8 @@ private:
|
||||||
std::to_string(instr.alu.GetSignedImm20_20())};
|
std::to_string(instr.alu.GetSignedImm20_20())};
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return {regs.GetRegisterAsInteger(instr.gpr39, 0, false),
|
||||||
|
std::to_string(instr.alu.GetSignedImm20_20())};
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
const std::string offset = '(' + packed_shift + " & 0xff)";
|
const std::string offset = '(' + packed_shift + " & 0xff)";
|
||||||
|
@ -3314,6 +3318,7 @@ private:
|
||||||
return std::to_string(instr.r2p.immediate_mask);
|
return std::to_string(instr.r2p.immediate_mask);
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return std::to_string(instr.r2p.immediate_mask);
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
const std::string mask = '(' + regs.GetRegisterAsInteger(instr.gpr8, 0, false) +
|
const std::string mask = '(' + regs.GetRegisterAsInteger(instr.gpr8, 0, false) +
|
||||||
|
@ -3777,7 +3782,9 @@ private:
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: { UNIMPLEMENTED_MSG("Unhandled instruction: {}", opcode->get().GetName()); }
|
default: {
|
||||||
|
UNIMPLEMENTED_MSG("Unhandled instruction: {}", opcode->get().GetName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -3932,4 +3939,4 @@ std::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code, u
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace OpenGL::GLShader::Decompiler
|
} // namespace OpenGL::GLShader::Decompiler
|
||||||
|
|
|
@ -427,6 +427,7 @@ static const char* GetSource(GLenum source) {
|
||||||
RET(OTHER);
|
RET(OTHER);
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return "Unknown source";
|
||||||
}
|
}
|
||||||
#undef RET
|
#undef RET
|
||||||
}
|
}
|
||||||
|
@ -445,6 +446,7 @@ static const char* GetType(GLenum type) {
|
||||||
RET(MARKER);
|
RET(MARKER);
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return "Unknown type";
|
||||||
}
|
}
|
||||||
#undef RET
|
#undef RET
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) {
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return PixelFormat::S8Z24;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +142,7 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return PixelFormat::RGBA8_SRGB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,6 +329,7 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
|
||||||
LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}", static_cast<u32>(format),
|
LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}", static_cast<u32>(format),
|
||||||
static_cast<u32>(component_type));
|
static_cast<u32>(component_type));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return PixelFormat::ABGR8U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,6 +349,7 @@ ComponentType ComponentTypeFromTexture(Tegra::Texture::ComponentType type) {
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type));
|
LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return ComponentType::UNorm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,6 +397,7 @@ ComponentType ComponentTypeFromRenderTarget(Tegra::RenderTargetFormat format) {
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return ComponentType::UNorm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,6 +408,7 @@ PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return PixelFormat::ABGR8U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,6 +424,7 @@ ComponentType ComponentTypeFromDepthFormat(Tegra::DepthFormat format) {
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return ComponentType::UNorm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ u32 BytesPerPixel(TextureFormat format) {
|
||||||
return 8;
|
return 8;
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_MSG("Format not implemented");
|
UNIMPLEMENTED_MSG("Format not implemented");
|
||||||
break;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ static Tegra::Texture::TextureFormat ConvertToTextureFormat(
|
||||||
return Tegra::Texture::TextureFormat::A2B10G10R10;
|
return Tegra::Texture::TextureFormat::A2B10G10R10;
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_MSG("Unimplemented RT format");
|
UNIMPLEMENTED_MSG("Unimplemented RT format");
|
||||||
|
return Tegra::Texture::TextureFormat::A8R8G8B8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue