Skip to content

Commit 0a00f90

Browse files
committed
Internal code optimizations and documentation updates
1 parent 523d296 commit 0a00f90

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

doc/src/release_notes.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ Thick Mode Changes
3838
Additionally, this fix resolves the issue related to JS numbers with
3939
precisions where `2.3` is returned as `2.300003`.
4040

41-
#) Fixed a regression that caused ``deqOne()``and ``deqMany()`` to return an
42-
invalid object in 6.4 instead of undefined, which was returned in the
43-
previous releases.
44-
See `Issue #1656 <https://github.com/oracle/node-oracledb/issues/1656>`__.
41+
#) Fixed a regression that caused :meth:`~aqQueue.deqOne()` and
42+
:meth:`~aqQueue.deqMany()` to return an invalid object in node-oracledb
43+
6.4 instead of undefined, which was returned in the previous releases.
44+
See `Issue #1656 <https://github.com/oracle/node-oracledb/issues/1656>`__.
4545

4646
node-oracledb `v6.4.0 <https://github.com/oracle/node-oracledb/compare/v6.3.0...v6.4.0>`__ (11 Mar 2024)
4747
--------------------------------------------------------------------------------------------------------

lib/thin/protocol/utils.js

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,23 @@ function encodeRowID(rowID) {
5252
}
5353
}
5454

55-
// obfuscate value and clear memory for Buffers as they are from Buffer pool
56-
// and are possible to stay longer
55+
// obfuscate value
5756
function setObfuscatedValue(value) {
58-
const buf = crypto.randomBytes(Buffer.byteLength(value));
59-
const bytes = Buffer.from(value, 'utf8');
60-
const len = Buffer.byteLength(value);
61-
62-
const arr = [];
63-
for (let i = 0; i < len; i++) {
64-
arr.push(buf[i] ^ bytes[i]);
57+
const valueBytes = Buffer.from(value);
58+
const obfuscatedBytes = crypto.randomBytes(valueBytes.length);
59+
for (let i = 0; i < valueBytes.length; i++) {
60+
valueBytes[i] = obfuscatedBytes[i] ^ valueBytes[i];
6561
}
66-
bytes.fill(0);
67-
return {obfuscatedValue: buf, value: arr};
62+
return {obfuscatedValue: obfuscatedBytes, value: valueBytes};
6863
}
6964

70-
// returns the Deobfuscated value, after removing the obfuscation
65+
// returns the deobfuscated value, after removing the obfuscation
7166
// and clear memory of temporary Buffers coming from Buffer pool
72-
function getDeobfuscatedValue(value, obfuscatedValue) {
73-
const arr = [];
74-
for (let i = 0; i < value.length; i++) {
75-
arr.push(value[i] ^ obfuscatedValue[i]);
67+
function getDeobfuscatedValue(valueBytes, obfuscatedBytes) {
68+
const buf = Buffer.from(valueBytes);
69+
for (let i = 0; i < valueBytes.length; i++) {
70+
buf[i] = valueBytes[i] ^ obfuscatedBytes[i];
7671
}
77-
const buf = Buffer.from(arr);
78-
arr.fill(0);
7972
const retVal = buf.toString();
8073
buf.fill(0);
8174
return retVal;

0 commit comments

Comments
 (0)