Skip to content

Conversation

@apapirovski
Copy link
Contributor

@apapirovskiapapirovski commented Aug 9, 2018

Well, that was stupid... This check used to be for 0xfffffff which was wrong (one f too few) so that got fixed, but that change was made based on it being cast to a uint32_t (2**32-1) rather than the correct int32_t. Of course, Integer::New just happily accepted it despite not actually being able to handle it. Fun stuff...

Fixes#22149

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Aug 9, 2018
uint64_t now = uv_now(event_loop());
CHECK_GE(now, timer_base());
now -= timer_base();
if (now <= 0xffffffff)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have an U suffix…?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't matter in this case, right? I thought they were equivalent since this won't fit into an int and the next type is unsigned int.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I looked it up – without the suffix it is still signed, but it’s a long int in that case, so we’re probably fine here. :)

@apapirovski
Copy link
ContributorAuthor

@ChALkeR
Copy link
Member

ChALkeR commented Aug 9, 2018

This was introduced in #18486 and shouldn't affect versions prior to 10.0.0, correct?

@ChALkeRChALkeR added dont-land-on-v6.x timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. labels Aug 9, 2018
@maclover7maclover7 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 10, 2018
@trivikr
Copy link
Member

Landed in 01a160a

@trivikrtrivikr closed this Aug 12, 2018
trivikr pushed a commit that referenced this pull request Aug 12, 2018
PR-URL: #22214 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
targos pushed a commit that referenced this pull request Aug 12, 2018
PR-URL: #22214 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
@rvaggrvagg mentioned this pull request Aug 13, 2018
@apapirovskiapapirovski deleted the fix-integer-overflow-timers branch August 15, 2018 14:46
uint64_t now = uv_now(event_loop());
CHECK_GE(now, timer_base());
now -= timer_base();
if (now <= 0xffffffff)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that the bug still exists for numbers in 2^31 .. 2^32 range?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nkbt This PR fixed the bug for those numbers – all others should remain the same

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I was not sure if NewFromUnsigned does exactly that

firass111 pushed a commit to firass111/Project_node1 that referenced this pull request Apr 16, 2025
PR-URL: nodejs/node#22214 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.timersIssues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setInterval callback function unexpected halt

15 participants

@apapirovski@nodejs-github-bot@ChALkeR@trivikr@nkbt@bmeck@jasnell@addaleax@benjamingr@lpinca@TimothyGu@cjihrig@mmarchini@BridgeAR@maclover7