Fix crash while editing asm.
Some checks failed
CI / ${{ matrix.name }} (/usr/bin/gcc-12, /usr/bin/g++-12, ubuntu:22.04, linux-x86_64-system-deps, false, 3.10.x, true, false) (push) Has been cancelled
CI / ${{ matrix.name }} (default, default, 6) (push) Has been cancelled
CI / ${{ matrix.name }} (ubuntu:20.04, linux-x86_64, true, 3.6.x, false, false) (push) Has been cancelled
CI / ${{ matrix.name }} (ubuntu:20.04, tarball, false, 3.6.x, false, true) (push) Has been cancelled
CI / ${{ matrix.name }} (/usr/bin/gcc-7, /usr/bin/g++-7, ubuntu:18.04, linux-x86_64-qt5-system-deps, false, 3.6.x, 5, true) (push) Has been cancelled
CI / ${{ matrix.name }} (ubuntu:18.04, linux-x86_64-qt5, true, 3.6.x, 5, false) (push) Has been cancelled
CI / ${{ matrix.name }} () (push) Has been cancelled
CI / ${{ matrix.name }} (3.12.x) (push) Has been cancelled
CI / ${{ matrix.name }} (arm64, macos-arm64, macos-14, artifact_macos, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false) (push) Has been cancelled
CI / ${{ matrix.name }} (windows-x86_64, windows-2019, artifact_windows, true, 3.12.x) (push) Has been cancelled
CI / ${{ matrix.name }} (x86_64, macos-x86_64, macos-13, true) (push) Has been cancelled
Docs / deploy (push) Has been cancelled
Linter / changes (push) Has been cancelled
CI / plugin-test-${{ matrix.name }} (build, artifact_macos, macos-arm64, macos-14) (push) Has been cancelled
CI / plugin-test-${{ matrix.name }} (build, artifact_windows, windows, windows-2019) (push) Has been cancelled
CI / plugin-test-${{ matrix.name }} (build-linux, artifact_linux, linux-x86_64, ubuntu-20.04) (push) Has been cancelled
Linter / clang-format (push) Has been cancelled
coverity-scan / latest (push) Has been cancelled

Empty input field resulted in empty byteArray and constData pointing to null, which rz_hex_bin2str didn't expect.
This commit is contained in:
Karliss 2025-01-10 18:25:47 +02:00 committed by karliss
parent 8d1cedfb32
commit db140ee3fb

View File

@ -4293,10 +4293,7 @@ QByteArray CutterCore::hexStringToBytes(const QString &hex)
QString CutterCore::bytesToHexString(const QByteArray &bytes)
{
QByteArray hex;
hex.resize(bytes.length() * 2);
rz_hex_bin2str(reinterpret_cast<const ut8 *>(bytes.constData()), bytes.size(), hex.data());
return QString::fromUtf8(hex);
return QString::fromUtf8(bytes.toHex());
}
void CutterCore::loadScript(const QString &scriptname)