jasonrogena / jasonrogena/php-excel-reader

read16bitstring() is buggy in v2.21

Open
#73 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
PHP
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
Function read16bitstring() incorrectly calculates length of 16-bit strings,
resulting in cropped strings and
corresponding notices from iconv() about incomplete multibyte characters.

To fix, please replace (line 830):

while (ord($data[$start + $len]) + ord($data[$start + $len + 1]) > 0) $len++;

with:

while (ord($data[$start + $len]) + ord($data[$start + $len + 1]) > 0) $len+=2;
```

Original issue reported on code.google.com by `alexanderk23` on 22 Apr 2010 at 7:45

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the read16bitstring() function at line 830 and inspect how $len advances while scanning $data. Apply the requested length-step correction, then verify that 16-bit strings are no longer cropped and that iconv() no longer reports incomplete multibyte characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.