GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deps: V8: backport a05177279022 · nodejs/node@cfb5501

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common.gypi
  • deps/v8/src/objects
    • js-temporal-zoneinfo64.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
# Reset this number to 0 on major V8 upgrades.
5252
# Increment by one for each non-official patch applied to deps/v8.
53-
'v8_embedder_string': '-node.13',
53+
'v8_embedder_string': '-node.14',
5454

5555
##### V8 defaults for Node.js #####
5656

Collapse file

‎deps/v8/src/objects/js-temporal-zoneinfo64.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/objects/js-temporal-zoneinfo64.cc
+47-3Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "temporal_rs/TimeZone.hpp"
1212

1313
#ifdef V8_INTL_SUPPORT
14-
#ifndef V8_ENABLE_TEMPORAL_SYSTEMICU
14+
#if !defined(V8_ENABLE_TEMPORAL_SYSTEMICU) && !defined(USING_SYSTEM_ICU)
1515
// ICU internal header file
1616
#include "udatamem.h"
1717
#else
@@ -58,7 +58,7 @@ ZoneInfo64Provider::ZoneInfo64Provider() {
5858
provider = temporal_rs::Provider::empty();
5959
return;
6060
}
61-
#ifndef V8_ENABLE_TEMPORAL_SYSTEMICU
61+
#if !defined(V8_ENABLE_TEMPORAL_SYSTEMICU) && !defined(USING_SYSTEM_ICU)
6262
// NOT udata_getLength: this ignores the header,
6363
// and we're parsing resb files with the header
6464
auto length = memory->length;
@@ -71,6 +71,51 @@ ZoneInfo64Provider::ZoneInfo64Provider() {
7171
auto length = shadowMemory->length;
7272
auto data = shadowMemory->data;
7373
#endif
74+
DCHECK_WITH_MSG(data != nullptr, "ICU4C returned nullptr");
75+
if (data == nullptr) {
76+
provider = temporal_rs::Provider::empty();
77+
return;
78+
}
79+
// ICU4C sets length = -1 for the last entry in an offset TOC (.dat) archive
80+
// (e.g. when zoneinfo64.res is the final entry in a small-icu build) and for
81+
// all entries in a pointer TOC archive. Determine the exact byte length of
82+
// the ResB bundle from its self-describing index table (see res_init() in
83+
// ICU4C's uresdata.cpp).
84+
int32_t resb_length = -1;
85+
const void* body = udata_getMemory(memory);
86+
if (body != nullptr) {
87+
ptrdiff_t header_length =
88+
static_cast<const uint8_t*>(body) - static_cast<const uint8_t*>(data);
89+
constexpr uint32_t kUresIndexBundleTop = 3;
90+
constexpr ptrdiff_t kMinResbBytes = static_cast<ptrdiff_t>(
91+
(1 + 1 + kUresIndexBundleTop) * sizeof(uint32_t));
92+
if (header_length >= 0 && header_length % 4 == 0 &&
93+
(length == -1 || length >= header_length + kMinResbBytes)) {
94+
const uint32_t* body_32 = static_cast<const uint32_t*>(body);
95+
// body_32[0] is the root resource word; body_32[1..] is indexes[].
96+
// indexes[URES_INDEX_LENGTH] & 0xff holds the length of indexes[].
97+
uint32_t index_length = body_32[1] & 0xff;
98+
if (index_length > kUresIndexBundleTop) {
99+
// indexes[URES_INDEX_BUNDLE_TOP] is the number of 32-bit words in the
100+
// bundle body.
101+
uint32_t bundle_top = body_32[1 + kUresIndexBundleTop];
102+
if (bundle_top >= 1 + index_length && bundle_top <= 0x1000000) {
103+
resb_length = static_cast<int32_t>(header_length) +
104+
static_cast<int32_t>(bundle_top * sizeof(uint32_t));
105+
}
106+
}
107+
}
108+
}
109+
DCHECK_WITH_MSG(resb_length != -1,
110+
"zoneinfo64.res should have a valid ResB index table");
111+
DCHECK_IMPLIES(length != -1, resb_length <= length);
112+
if (resb_length == -1 || (length != -1 && resb_length > length)) {
113+
provider = temporal_rs::Provider::empty();
114+
return;
115+
}
116+
if (length == -1) {
117+
length = resb_length;
118+
}
74119
// This really shouldn't happen: ICU4C pads these files
75120
// to 4 when baking them in
76121
DCHECK_WITH_MSG(length % 4 == 0, "ICU4C should pad udata to uint32_t");
@@ -80,7 +125,6 @@ ZoneInfo64Provider::ZoneInfo64Provider() {
80125
provider = temporal_rs::Provider::empty();
81126
return;
82127
}
83-
DCHECK_WITH_MSG(data != nullptr, "ICU4C returned nullptr");
84128

85129
const uint32_t* data_32 = static_cast<const uint32_t*>(data);
86130
std::span<const uint32_t> data_span(data_32, length / 4);

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.