Commit Graph

24 Commits

Author SHA1 Message Date
Storm Dragon
16d146a9ae Implement reliable HTML heading navigation using tag-based detection
This commit completely overhauls the heading navigation feature (d/shift+D keys)
to use actual HTML tag information instead of unreliable text-based heuristics.

Key improvements:
- Navigation now works 100% reliably by tracking actual <h1>-<h6> HTML tags
- Eliminates false positives from bold text, links, and buttons
- No longer navigates to blank lines around headings
- Provides true screen reader-style heading navigation

Technical implementation:
- Added LINE_FLAG_HEADING flag to mark heading lines during HTML processing
- Enhanced readbuffer with in_heading field to track heading tag state
- Modified HTML parser to set/clear heading flags on <h>/<\/h> tags
- Updated TextLine and Line structures to preserve heading information
- Simplified navigation functions to use reliable flag-based detection
- Added content length check to avoid marking blank spacing lines

Also includes compilation fixes for modern GCC:
- Fixed function pointer type compatibility issues
- Updated signal handler declarations
- Resolved deprecation warnings for various system calls

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 02:11:37 -04:00
NRK
3ab68dd361 properly close va_list 2022-04-24 06:10:12 +06:00
Rene Kita
916104b7f2 Remove unused variable 2022-02-20 11:14:53 +01:00
Tatsuya Kinoshita
d9d9d7b278 Reduce memory reallocation due to Strgrow 2021-03-23 19:13:05 +09:00
Tatsuya Kinoshita
15520de3aa Check STR_SIZE_MAX in Strcat_char 2021-03-21 12:51:08 +09:00
Tatsuya Kinoshita
8d16266f0e Prevent very small allocation in Str.c 2021-03-20 23:57:47 +09:00
Tatsuya Kinoshita
ec43154493 Decrease STR_SIZE_MAX to prevent large memory usage 2021-03-19 22:15:07 +09:00
Tatsuya Kinoshita
58d8af31d1 Prevent redundant memory reallocation in Str.c 2021-03-05 06:55:56 +09:00
Tatsuya Kinoshita
13015ebcf6 Prevent unneeded Strgrow in Strinsert_char 2021-03-04 23:46:21 +09:00
Tatsuya Kinoshita
e11bb2b868 Consider Strgrow overflow in Strinsert_char 2021-03-04 22:18:03 +09:00
Tatsuya Kinoshita
91731ec385 Prevent unneeded memory allocation in Strgrow 2021-03-04 07:03:18 +09:00
Tatsuya Kinoshita
2b68bdf4ba Prevent large memory usage and null-deref in Str.c
Bug-Chromium: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31579
Bug-Chromium: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31589
2021-03-02 19:48:39 +09:00
Tatsuya Kinoshita
38cbe69280 Prevent zero size allocation in Str.c 2021-03-01 06:48:57 +09:00
Tatsuya Kinoshita
dcbdb679aa Prevent unintentional integer overflow in Strcat_charp_n
Bug-Chromium: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31500
2021-02-28 16:16:08 +09:00
Tatsuya Kinoshita
f37f074cdf Prevent unintentional integer overflow in Strgrow
Bug-Chromium: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31467
2021-02-28 16:16:06 +09:00
Tatsuya Kinoshita
31d0457609 One more fix overflow due to Strgrow
Bug-Chromium: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31397
2021-02-27 09:17:07 +09:00
Tatsuya Kinoshita
f29533cc7b Fix potential overflow due to Str.c 2021-02-26 19:38:51 +09:00
Tatsuya Kinoshita
f0aff94b2b Fix integer overflow due to Strgrow
Bug-Chromium: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31397
2021-02-26 19:38:20 +09:00
Tatsuya Kinoshita
4381dffaa3 Prevent heap-buffer-overflow in Strnew_size()
Bug-Debian: https://github.com/tats/w3m/issues/72
2016-12-10 18:18:58 +09:00
Kuang-che Wu
c95a43dc92 Fix potential heap buffer corruption due to Strgrow
If Str.length = 5 and area_size = 6, the result of Strgrow is still
area_size = 6. For such case, Strcat_char and Strinsert_char will
overflow one byte.
2016-08-30 09:39:53 +08:00
David Crosby
c162b75317 Use fgetc in while loops, use int instead of char 2015-08-11 21:59:27 +09:00
Richard Quirk
91405c0d06 Strnew_charp and co do not modify the char* input 2015-07-25 15:21:33 +02:00
Tatsuya Kinoshita
8164da9e3e Check length for Strchop() 2013-08-04 16:27:00 +09:00
Tatsuya Kinoshita
72f72d64a4 Adding upstream version 0.5.1 2011-05-04 16:05:14 +09:00