Bug 154285 - IsNumeric(1,2) returns True, must produce an error
Summary: IsNumeric(1,2) returns True, must produce an error
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0 target:24.8.0 target:25...
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2023-03-20 12:11 UTC by Mike Kaganski
Modified: 2025-05-07 05:42 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2023-03-20 12:11:40 UTC
IsNumeric (and some other Basic run-time functions) does not fail when called with more arguments than it takes. E.g., this gives True:

  IsNumeric(1,2)

The problem is not only strict correctness: people might actually confuse this notation for testing of a "one and two tenths", while actually it's two integer arguments passed to the function, and the second argument is simply ignored. See e.g. bug 123158 comment 8.

The task is to check all the functions in basic/source/runtime/methods.cxx and basic/source/runtime/methods1.cxx, locate all the function implementations that do not check the upper bound of the number of arguments passed to them (in case of IsNumeric, the implementation would be SbRtl_IsNumeric), check if these functions indeed allow passing arbitrary number of arguments (an example of such a function, that can rightfully take unlimited number of arguments, is Array(), and its implementation SbRtl_Array), and for all functions that *can't* take arbitrary number of arguments, introduce respective check setting an error.

Every fixed function must have a separate commit, in case when it causes a regression that requires a revert (who knows). So this is an easyhack which can be done in parallel, by several people.
Comment 1 Xisco Faulí 2023-03-20 12:29:58 UTC
Moving to NEW
Comment 2 potatochick2020 2023-03-20 13:06:01 UTC
I am interested in taking this.
Comment 3 Commit Notification 2023-10-13 15:05:04 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c4c017d1b8fe30d1ef452782eef71371282deb37

tdf#147132  tdf#154285 Flatten and check param count of IsMissing fn

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2024-02-08 23:30:30 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8318337c3e30075acc72fa8c9d5051c33319fdf5

tdf#147132 tdf#154285 basic: Flatten and check param count of Is* fns

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2024-02-13 04:52:03 UTC
Adam Seskunas committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/95dace2eb1ae7ce2fc000cc67e134b7bfadf2c35

tdf#154285 Check upper bound of arguments in SbRtl_CurDir

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2025-01-05 15:00:18 UTC
Alin Andrei Abahnencei committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/022e95d39d9ae29496be0f81740eefaf515f578a

tdf#154285 Check upper bound of arguments in SbRtl_Minute function

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Alin Andrei Abahnencei 2025-01-09 11:53:59 UTC
Hey! I provided a new patch for this. Can anyone review it?
Comment 8 Mike Kaganski 2025-01-09 12:14:12 UTC
(In reply to Alin Andrei Abahnencei from comment #7)

As explained in EasyHack Wiki [1]:

> Add the person who provided the code pointers as a reviewer for your patch

Without that, how could someone know there's something waiting for review?

[1] https://wiki.documentfoundation.org/Development/EasyHacks#What_happens_once_you_have_submitted_your_patch_via_gerrit
Comment 9 Commit Notification 2025-01-09 12:16:23 UTC
Alin Andrei Abahnencei committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e08ed1d92f083cc604cb25eb284deb21016268fd

tdf#154285 Check upper bound of arguments in SbRtl_Year function

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2025-01-09 12:17:26 UTC
Alin Andrei Abahnencei committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/633a787707786de7a535070efbd81781430395e7

tdf#154285 Check upper bound of arguments in SbRtl_Day function

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2025-01-09 12:18:29 UTC
Alin Andrei Abahnencei committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/73dc528db8418720cdab81cfaf5a1589693a3e90

tdf#154285 Check upper bound of arguments in SbRtl_Month function

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2025-01-09 12:19:32 UTC
Alin Andrei Abahnencei committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7419fc569f07fbd5685a6e58439b681a52fdd045

tdf#154285 Check upper bound of arguments in SbRtl_Hour function

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2025-01-09 12:20:34 UTC
Alin Andrei Abahnencei committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8e48c41a218b33eafa383429995a840d08523fa1

tdf#154285 Check upper bound of arguments in SbRtl_Second function

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2025-02-09 07:57:12 UTC
Simon Chenery committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b22f9843e6801621538e132ad332f1870e2bef16

tdf#154285 Check correct number of arguments to SbRtl_Now function

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2025-02-11 21:33:28 UTC
Simon Chenery committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/0b34aab50fc803bfe100a2b4dbe62a52ae3dccb3

tdf#154285 Error code 5 Invalid procedure call possible for NOW()
Comment 16 Commit Notification 2025-02-12 06:42:24 UTC
Simon Chenery committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6586dbe9569be562c5be1982d488417fb08b082e

tdf#154285 Check too many arguments to SbRtl_Abs() for BASIC ABS function

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Commit Notification 2025-03-31 04:49:27 UTC
Simon Chenery committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/45ff93aea24222a02c292c0ac443993f030dbb4d

tdf#154285 Check too many arguments to BASIC WEEKDAY function

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2025-05-07 05:42:04 UTC
Ahmed Khaled committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b710ba48503372ddaf10a17ce7f4f3340bc8adb8

tdf#154285 Check upper bound of arguments in SbRtl_FindObject &

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.