https://bugs.kde.org/show_bug.cgi?id=516865

            Bug ID: 516865
           Summary: akonadi_html_to_text crashing as kmail is indexing
                    empty emails
    Classification: Frameworks and Libraries
           Product: Akonadi
      Version First unspecified
       Reported In:
          Platform: Debian unstable
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: libakonadi
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Created attachment 190214
  --> https://bugs.kde.org/attachment.cgi?id=190214&action=edit
coredump.txt

SUMMARY

When *supposedly* indexing emails with empty body, kmail makes
akonadi_html_to_text crash.

STEPS TO REPRODUCE

Short repro
=========

$ echo -n '' |akonadi_html_to_text.real

thread '<unnamed>' (22200) panicked at
/usr/share/cargo/registry/html2text-0.12.6/src/lib.rs:2436:10: 
Failed to convert to HTML: TooNarrow 
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 

thread '<unnamed>' (22200) panicked at
/usr/share/cargo/registry/cxx-1.0.192/src/unwind.rs:37:9: 
panic in ffi function htmlparser::ffi::convert_to_text, aborting. 
stack backtrace: 
0:     0x5639dc439d25 - <unknown> 
1:     0x5639dc45543f - <unknown> 
2:     0x5639dc43a17f - <unknown> 
3:     0x5639dc431888 - <unknown> 
4:     0x5639dc438fe4 - <unknown> 
5:     0x5639dc438ea3 - <unknown> 
6:     0x5639dc439321 - <unknown> 
7:     0x5639dc4391ba - <unknown> 
8:     0x5639dc438da9 - <unknown> 
9:     0x5639dc437e4d - <unknown> 
10:     0x5639dc41ed80 - <unknown> 
11:     0x5639dc41b4f8 - <unknown> 
12:     0x5639dc423a03 - <unknown> 
13:     0x5639dc42297b - <unknown> 
14:     0x5639dc42258b - <unknown> 
15:     0x7fbda1c33f75 - __libc_start_call_main 
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16 
16:     0x7fbda1c34027 - __libc_start_main_impl 
at ./csu/../csu/libc-start.c:360:3 
17:     0x5639dc422771 - <unknown> 
18:                0x0 - <unknown> 

thread '<unnamed>' (22200) panicked at library/core/src/panicking.rs:233:5: 
panic in a destructor during cleanup 
thread caused non-unwinding panic. aborting. 
Aborted                    (core dumped) echo -n '' | akonadi_html_to_text.real

Long repro
=========

Build a wrapper to akonadi_html_to_text to know which input makes it fail:

#!/bin/bash
set -euo pipefail

REAL="/usr/bin/akonadi_html_to_text.real"
LOG_DIR="/tmp/akonadi_debug"
mkdir -p "$LOG_DIR"

TS=$(date +%s)
PID=$$
BASE="$LOG_DIR/akonadi_${TS}_${PID}"

STDIN_FILE="${BASE}.stdin"
META_FILE="${BASE}.meta"

# Save stdin first
cat > "$STDIN_FILE"

# Skip empty input entirely
if [ ! -s "$STDIN_FILE" ]; then
rm -f "$STDIN_FILE"
exit 0
fi

# Log metadata
{
echo "timestamp: $(date -Is)"
echo "pid: $$"
echo "args: $*"
echo "stdin_file: $STDIN_FILE"
} > "$META_FILE"

# Execute real binary with captured stdin
"$REAL" "$@" < "$STDIN_FILE"
STATUS=$?

# Log exit status
echo "exit_status: $STATUS" >> "$META_FILE"

# If success, clean up
if [ "$STATUS" -eq 0 ]; then
rm -f "$STDIN_FILE" "$META_FILE"
else
echo "Crash detected. Input preserved at:"
echo "  $STDIN_FILE"
echo "Metadata:"
echo "  $META_FILE"
fi

exit "$STATUS"

OBSERVED RESULT

Got a SIGABRT with a core dump, attached as a file.

This keep looping creating tons of core dumps until I change the
akonadi_html_to_text binary.

EXPECTED RESULT

akonadi_html_to_text shouldn't crash

SOFTWARE/OS VERSIONS

MESA-INTEL: warning: Haswell Vulkan support is incomplete
Operating System: Debian GNU/Linux forky/sid
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.23.0
Qt Version: 6.9.2
Kernel Version: 6.18.13+deb14-amd64 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-4308U CPU @ 2.80GHz
Memory: 16 GiB of RAM (15.5 GiB usable)
Graphics Processor: Intel® Iris® Graphics 5100

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to