helloadhavan/github_issues huggingface dataset:
Repository: facebook/react
Pull request: Add changelog for 18.3

Fixes https://github.com/facebook/react/issues/28924

Changed files:
filename: CHANGELOG.md
patch: @@ -1,3 +1,24 @@
+## 18.3.0 (April 25, 2024)
+
+This release is identical to 18.2 but adds warnings for deprecated APIs and other changes that are needed for React 19.
+
+Read the [React 19 Upgrade Guide](https://react.dev/blog/2024/04/25/react-19-upgrade-guide) for more info.
+
+### React
+
+- Allow writing to `this.refs` to support string ref codemod [909071](https://github.com/facebook/react/commit/9090712fd3ca4e1099e1f92e67933c2cb4f32552)
+- Warn for deprecated `findDOMNode` outside StrictMode [c3b283](https://github.com/facebook/react/commit/c3b283964108b0e8dbcf1f9eb2e7e67815e39dfb)
+- Warn for deprecated `test-utils` methods [d4ea75](https://github.com/facebook/react/commit/d4ea75dc4258095593b6ac764289f42bddeb835c)
+- Warn for deprecated Legacy Context outside StrictMode [415ee0](https://github.com/facebook/react/commit/415ee0e6ea0fe3e288e65868df2e3241143d5f7f)
+- Warn for deprecated string refs outside StrictMode [#25383](https://github.com/facebook/react/pull/25383)
+- Warn for deprecated `defaultProps` for function components [#25699](https://github.com/facebook/react/pull/25699)
+- Warn when spreading `key` [#25697](https://github.com/facebook/react/pull/25697)
+- Warn when using `act` from `test-utils` [d4ea75](https://github.com/facebook/react/commit/d4ea75dc4258095593b6ac764289f42bddeb835c)
+
+### React DOM
+- Warn for deprecated `unmountComponentAtNode` [8a015b](https://github.com/facebook/react/commit/8a015b68cc060079878e426610e64e86fb328f8d)
+- Warn for deprecated `renderToStaticNodeStream` [#28874](https://github.com/facebook/react/pull/28874)
+
 ## 18.2.0 (June 14, 2022)
 
 ### React DOM
Repository: electron/electron
Pull request: build: update build tools

Backport of #46656

See that PR for details.


Notes: <!-- Please add a one-line description for app developers to read in the release notes, or 'none' if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/main/README.md#examples -->none


Changed files:
filename: .github/actions/install-build-tools/action.yml
patch: @@ -10,8 +10,10 @@ runs:
         git config --global core.filemode false
         git config --global core.autocrlf false
         git config --global branch.autosetuprebase always
+        git config --global core.fscache true
+        git config --global core.preloadindex true
       fi
-      export BUILD_TOOLS_SHA=8246e57791b0af4ae5975eb96f09855f9269b1cd
+      export BUILD_TOOLS_SHA=6e8526315ea3b4828882497e532b8340e64e053c
       npm i -g @electron/build-tools
       e auto-update disable
       e d auto-update disable

filename: .github/workflows/pipeline-segment-electron-test.yml
patch: @@ -134,6 +134,8 @@ jobs:
         git config --global core.filemode false
         git config --global core.autocrlf false
         git config --global branch.autosetuprebase always
+        git config --global core.fscache true
+        git config --global core.preloadindex true
         git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
         # Ensure depot_tools does not update.
         test -d depot_tools && cd depot_tools
Repository: ollama/ollama
Pull request: fix cross device rename

`os.Rename` is only intended for files on the same filesystem. Instead of messing around with that, store the temporary file in the blobs directory

resolves #1181 

Changed files:
filename: server/routes.go
patch: @@ -666,8 +666,14 @@ func HeadBlobHandler(c *gin.Context) {
 }
 
 func CreateBlobHandler(c *gin.Context) {
+	targetPath, err := GetBlobsPath(c.Param("digest"))
+	if err != nil {
+		c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
+		return
+	}
+
 	hash := sha256.New()
-	temp, err := os.CreateTemp("", c.Param("digest"))
+	temp, err := os.CreateTemp(filepath.Dir(targetPath), c.Param("digest"))
 	if err != nil {
 		c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
 		return
@@ -690,12 +696,6 @@ func CreateBlobHandler(c *gin.Context) {
 		return
 	}
 
-	targetPath, err := GetBlobsPath(c.Param("digest"))
-	if err != nil {
-		c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
-		return
-	}
-
 	if err := os.Rename(temp.Name(), targetPath); err != nil {
 		c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
 		return
Repository: facebook/react
Pull request: Add changelog for 18.3.1


Changed files:
filename: CHANGELOG.md
patch: @@ -1,3 +1,7 @@
+## 18.3.1 (April 26, 2024)
+
+- Export `act` from `react` [f1338f](https://github.com/facebook/react/commit/f1338f8080abd1386454a10bbf93d67bfe37ce85)
+
 ## 18.3.0 (April 25, 2024)
 
 This release is identical to 18.2 but adds warnings for deprecated APIs and other changes that are needed for React 19.
Repository: denoland/deno
Pull request: fix(ext/node): export ppid

Fix #31135 

ppid from node:process was not exported, this caused a deno crash.

Changed files:
filename: ext/node/polyfills/process.ts
patch: @@ -75,6 +75,7 @@ export let arch = "";
 export let platform = isWindows ? "win32" : ""; // initialized during bootstrap
 
 export let pid = 0;
+export let ppid = 0;
 
 let stdin, stdout, stderr;
 
@@ -1027,7 +1028,7 @@ internals.__bootstrapNodeProcess = function (
     arch = arch_();
     platform = isWindows ? "win32" : Deno.build.os;
     pid = Deno.pid;
-
+    ppid = Deno.ppid;
     initializeDebugEnv(nodeDebug);
 
     if (getOptionValue("--warnings")) {

filename: tests/unit/process_test.ts
patch: @@ -677,3 +677,25 @@ Deno.serve({ signal: ac.signal }, () => new Response("Hello World"));
     await Deno.remove(tempDir);
   },
 );
+
+Deno.test({
+  name: "process.ppid matches parent process",
+  permissions: { run: true, read: true },
+  ignore: Deno.build.os === "windows",
+  async fn() {
+    const command = new Deno.Command(Deno.execPath(), {
+      args: [
+        "eval",
+        "import { ppid } from 'node:process'; console.log(ppid);",
+      ],
+      stdout: "piped",
+    });
+
+    const { stdout } = await command.output();
+    const stdoutPpid = parseInt(
+      new TextDecoder().decode(stdout).trim(),
+    );
+
+    assertEquals(stdoutPpid, Deno.pid);
+  },
+});
Repository: ggml-org/llama.cpp
Pull request: webui: fix keyboard shortcuts for new chat & edit chat title

As per spec: https://www.w3.org/TR/uievents-key/#example-739eafdc

Built and tested. Static build included.

Changed files:
filename: tools/server/webui/src/routes/+layout.svelte
patch: @@ -44,12 +44,12 @@
 			}
 		}
 
-		if (isCtrlOrCmd && event.shiftKey && event.key === 'o') {
+		if (isCtrlOrCmd && event.shiftKey && event.key === 'O') {
 			event.preventDefault();
 			goto('?new_chat=true#/');
 		}
 
-		if (event.shiftKey && isCtrlOrCmd && event.key === 'e') {
+		if (event.shiftKey && isCtrlOrCmd && event.key === 'E') {
 			event.preventDefault();
 
 			if (chatSidebar?.editActiveConversation) {
Repository: ollama/ollama
Pull request: placeholder environment variables


Changed files:
filename: scripts/install.sh
patch: @@ -97,6 +97,16 @@ Environment="PATH=$PATH"
 [Install]
 WantedBy=default.target
 EOF
+
+    mkdir -p /etc/systemd/system/ollama.service.d
+    cat <<EOF | $SUDO tee /etc/systemd/system/ollama.service.d/environment.conf >/dev/null
+[Service]
+#Environment="OLLAMA_HOST="
+#Environment="OLLAMA_ORIGINS="
+#Environment="OLLAMA_MODELS="
+#Environment="HTTPS_PROXY="
+EOF
+
     SYSTEMCTL_RUNNING="$(systemctl is-system-running || true)"
     case $SYSTEMCTL_RUNNING in
         running|degraded)
Repository: vercel/next.js
Pull request: [sourcemaps] Always check for vendor chunks regardless of Node.js version

This PR reverts https://github.com/vercel/next.js/pull/81619 as version 18 gating is no longer necessary.

Changed files:
filename: packages/next/src/server/lib/source-maps.ts
patch: @@ -6,7 +6,7 @@ function noSourceMap(): SourceMap | undefined {
 }
 
 // Edge runtime does not implement `module`
-const nativeFindSourceMap =
+const findSourceMap =
   process.env.NEXT_RUNTIME === 'edge'
     ? noSourceMap
     : (require('module') as typeof import('module')).findSourceMap
@@ -104,13 +104,6 @@ export function findApplicableSourceMapPayload(
 
 const didWarnAboutInvalidSourceMapDEV = new Set<string>()
 
-const findSourceMap: (scriptNameOrSourceURL: string) => SourceMap | undefined =
-  process.env.NEXT_RUNTIME === 'nodejs' &&
-  process.versions.node?.startsWith('18')
-    ? // Node.js 18 has a horribly slow `findSourceMap` implementation
-      noSourceMap
-    : nativeFindSourceMap
-
 export function filterStackFrameDEV(
   sourceURL: string,
   functionName: string,
Repository: ollama/ollama
Pull request: faq: fix heading and add more details


Changed files:
filename: docs/faq.md
patch: @@ -149,8 +149,8 @@ docker build -t ollama-with-ca .
 docker run -d -e HTTPS_PROXY=https://my.proxy.example.com -p 11434:11434 ollama-with-ca
 ```
 
-### How do I use Ollama with GPU acceleration in Docker?
+## How do I use Ollama with GPU acceleration in Docker?
 
-The Ollama Docker container can be configured with GPU acceleration in Linux or Windows (with WSL2). This requires the [nvidia-container-toolkit](https://github.com/NVIDIA/nvidia-container-toolkit).
+The Ollama Docker container can be configured with GPU acceleration in Linux or Windows (with WSL2). This requires the [nvidia-container-toolkit](https://github.com/NVIDIA/nvidia-container-toolkit). See [ollama/ollama](https://hub.docker.com/r/ollama/ollama) for more details.
 
 GPU acceleration is not available for Docker Desktop in macOS due to the lack of GPU passthrough and emulation.
Repository: facebook/react
Pull request: Update canary channel label to "beta"

During the beta period, canaries will be published as `19.0.0-beta-<COMMIT_SHA>-<DATE>`. They will also be tagged as `beta` when published to npm.

Changed files:
filename: .circleci/config.yml
patch: @@ -639,7 +639,7 @@ workflows:
           # because this used to be called the "next" channel and some
           # downstream consumers might still expect that tag. We can remove this
           # after some time has elapsed and the change has been communicated.
-          dist_tag: "canary,next"
+          dist_tag: "canary,next,beta"
       - publish_prerelease:
           name: Publish to Experimental channel
           requires:
@@ -668,7 +668,7 @@ workflows:
           name: Publish to Canary channel
           commit_sha: << pipeline.git.revision >>
           release_channel: stable
-          dist_tag: "canary,next"
+          dist_tag: "canary,next,beta"
       - publish_prerelease:
           name: Publish to Experimental channel
           requires:

filename: ReactVersions.js
patch: @@ -26,7 +26,7 @@ const ReactVersion = '19.0.0';
 //
 // It only affects the label used in the version string. To customize the
 // npm dist tags used during publish, refer to .circleci/config.yml.
-const canaryChannelLabel = 'canary';
+const canaryChannelLabel = 'beta';
 
 const stablePackages = {
   'eslint-plugin-react-hooks': '5.1.0',
Repository: ollama/ollama
Pull request: update faq


Changed files:
filename: docs/faq.md
patch: @@ -148,3 +148,9 @@ Build and run this image:
 docker build -t ollama-with-ca .
 docker run -d -e HTTPS_PROXY=https://my.proxy.example.com -p 11434:11434 ollama-with-ca
 ```
+
+### How do I use Ollama with GPU acceleration in Docker?
+
+The Ollama Docker container can be configured with GPU acceleration in Linux or Windows (with WSL2). This requires the [nvidia-container-toolkit](https://github.com/NVIDIA/nvidia-container-toolkit).
+
+GPU acceleration is not available for Docker Desktop in macOS due to the lack of GPU passthrough and emulation.
Repository: ggml-org/llama.cpp
Pull request: server: fix correct time_ms calculation in prompt_progress

The time_ms field was incorrectly calculated. The division was happening before the subtraction leading to incorrect values.

Before: 
```cpp
(ggml_time_us() - slot.t_start_process_prompt / 1000)
```
 After: 
```cpp
(ggml_time_us() - slot.t_start_process_prompt) / 1000
```

*Make sure to read the [contributing guidelines](https://github.com/ggml-org/llama.cpp/blob/master/CONTRIBUTING.md) before submitting a PR*


Changed files:
filename: tools/server/README.md
patch: @@ -512,7 +512,7 @@ These words will not be included in the completion, so make sure to add them to
 
 `timings_per_token`: Include prompt processing and text generation speed information in each response.  Default: `false`
 
-`return_progress`: Include prompt processing progress in `stream` mode. The progress will be contained inside `prompt_progress` with 3 values: `total`, `cache` and `processed`. The overall progress is `processed/total`, while the actual timed progress is `(processed-cache)/(total-cache)`. Default: `false`
+`return_progress`: Include prompt processing progress in `stream` mode. The progress will be contained inside `prompt_progress` with 4 values: `total`, `cache`, `processed`, and `time_ms`. The overall progress is `processed/total`, while the actual timed progress is `(processed-cache)/(total-cache)`. The `time_ms` field contains the elapsed time in milliseconds since prompt processing started. Default: `false`
 
 `post_sampling_probs`: Returns the probabilities of top `n_probs` tokens after applying sampling chain.
 

filename: tools/server/server.cpp
patch: @@ -3078,7 +3078,7 @@ struct server_context {
             res->progress.total     = slot.task->n_tokens();
             res->progress.cache     = slot.n_prompt_tokens_cache;
             res->progress.processed = slot.prompt.tokens.size();
-            res->progress.time_ms   = (ggml_time_us() - slot.t_start_process_prompt / 1000);
+            res->progress.time_ms   = (ggml_time_us() - slot.t_start_process_prompt) / 1000;
         } else {
             res->content = tkn.text_to_send;
             res->tokens  = { tkn.tok };
Repository: ollama/ollama
Pull request: update faq


Changed files:
filename: docs/faq.md
patch: @@ -32,11 +32,11 @@ Create a `systemd` drop-in directory and set `Environment=OLLAMA_HOST`
 
 ```bash
 mkdir -p /etc/systemd/system/ollama.service.d
-echo "[Service]" >>/etc/systemd/system/ollama.service.d/environment.conf
+echo '[Service]' >>/etc/systemd/system/ollama.service.d/environment.conf
 ```
 
 ```bash
-echo "Environment=OLLAMA_HOST=0.0.0.0:11434" >>/etc/systemd/system/ollama.service.d/environment.conf
+echo 'Environment="OLLAMA_HOST=0.0.0.0:11434"' >>/etc/systemd/system/ollama.service.d/environment.conf
 ```
 
 Reload `systemd` and restart Ollama:
@@ -59,7 +59,7 @@ OLLAMA_ORIGINS=http://192.168.1.1:*,https://example.com ollama serve
 On Linux:
 
 ```bash
-echo "Environment=OLLAMA_ORIGINS=http://129.168.1.1:*,https://example.com" >>/etc/systemd/system/ollama.service.d/environment.conf
+echo 'Environment="OLLAMA_ORIGINS=http://129.168.1.1:*,https://example.com"' >>/etc/systemd/system/ollama.service.d/environment.conf
 ```
 
 Reload `systemd` and restart Ollama:
@@ -118,7 +118,7 @@ HTTPS_PROXY=http://proxy.example.com ollama serve
 On Linux:
 
 ```bash
-echo "Environment=HTTPS_PROXY=https://proxy.example.com" >>/etc/systemd/system/ollama.service.d/environment.conf
+echo 'Environment="HTTPS_PROXY=https://proxy.example.com"' >>/etc/systemd/system/ollama.service.d/environment.conf
 ```
 
 Reload `systemd` and restart Ollama:
Repository: huggingface/transformers
Pull request: Skip `TvpImageProcessingTest::test_slow_fast_equivalence`

Even with #40543, this test is still failing on CircleCI.

We really have to review this test in general, but let's just skip this for now.

Changed files:
filename: tests/models/tvp/test_image_processing_tvp.py
patch: @@ -19,7 +19,7 @@
 import numpy as np
 
 from transformers.image_transforms import PaddingMode
-from transformers.testing_utils import is_flaky, require_torch, require_vision
+from transformers.testing_utils import require_torch, require_vision
 from transformers.utils import is_torch_available, is_torchvision_available, is_vision_available
 
 from ...test_image_processing_common import ImageProcessingTestMixin, prepare_video_inputs
@@ -349,16 +349,16 @@ def test_call_pytorch(self):
 
     @require_vision
     @require_torch
-    @is_flaky(
-        description="FIXME: @yoni probably because of an extra 'time' dimension and since image processors don't handle it well?"
+    @unittest.skip(
+        reason="FIXME: @yoni probably because of an extra 'time' dimension and since image processors don't handle it well?"
     )
     def test_slow_fast_equivalence(self):
         super().test_slow_fast_equivalence()
 
     @require_vision
     @require_torch
-    @is_flaky(
-        description="FIXME: @yoni probably because of an extra 'time' dimension and since image processors don't handle it well?"
+    @unittest.skip(
+        reason="FIXME: @yoni probably because of an extra 'time' dimension and since image processors don't handle it well?"
     )
     def test_slow_fast_equivalence_batched(self):
         if not self.test_slow_image_processor or not self.test_fast_image_processor:
Repository: ollama/ollama
Pull request: update faq


Changed files:
filename: docs/faq.md
patch: @@ -130,6 +130,21 @@ systemctl restart ollama
 
 ### How do I use Ollama behind a proxy in Docker?
 
-Ollama Docker container can be configured to use a proxy by passing `-e HTTPS_PROXY=https://proxy.example.com` when starting the container. Ensure the certificate is installed as a system certificate when using HTTPS.
+The Ollama Docker container image can be configured to use a proxy by passing `-e HTTPS_PROXY=https://proxy.example.com` when starting the container.
 
 Alternatively, Docker daemon can be configured to use a proxy. Instructions are available for Docker Desktop on [macOS](https://docs.docker.com/desktop/settings/mac/#proxies), [Windows](https://docs.docker.com/desktop/settings/windows/#proxies), and [Linux](https://docs.docker.com/desktop/settings/linux/#proxies), and Docker [daemon with systemd](https://docs.docker.com/config/daemon/systemd/#httphttps-proxy).
+
+Ensure the certificate is installed as a system certificate when using HTTPS. This may require a new Docker image when using a self-signed certificate.
+
+```dockerfile
+FROM ollama/ollama
+COPY my-ca.pem /usr/local/share/ca-certificates/my-ca.crt
+RUN update-ca-certificate
+```
+
+Build and run this image:
+
+```shell
+docker build -t ollama-with-ca .
+docker run -d -e HTTPS_PROXY=https://my.proxy.example.com -p 11434:11434 ollama-with-ca
+```
Repository: denoland/deno
Pull request: fix(windows): strip periods and trailing slashes when normalizing paths

This is specifically for the application code. Not for any JS APIs.

Changed files:
filename: Cargo.lock
patch: @@ -2720,9 +2720,9 @@ dependencies = [
 
 [[package]]
 name = "deno_path_util"
-version = "0.6.3"
+version = "0.6.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4f70f7cbc884556f08781aaa75aef177d15bfee99e4fc40c25fa74514c678c0"
+checksum = "78c7e98943f0d068928906db0c7bde89de684fa32c6a8018caacc4cee2cdd72b"
 dependencies = [
  "deno_error",
  "percent-encoding",

filename: Cargo.toml
patch: @@ -74,7 +74,7 @@ deno_lockfile = "=0.32.2"
 deno_media_type = { version = "=0.2.9", features = ["module_specifier"] }
 deno_native_certs = "0.3.0"
 deno_npm = "=0.42.0"
-deno_path_util = "=0.6.3"
+deno_path_util = "=0.6.4"
 deno_semver = "=0.9.0"
 deno_task_shell = "=0.26.0"
 deno_terminal = "=0.2.2"

filename: tests/unit/command_test.ts
patch: @@ -787,15 +787,25 @@ Deno.test(
   async function rejectBatAndCmdFiles() {
     const tempDir = await Deno.makeTempDir();
     Deno.writeTextFileSync(tempDir + "/test.bat", "@echo off\r\necho 1 2 3 %*");
-    for (const ext of [".bat", ".BaT", ".bAT", ".BAT"]) {
+    for (
+      const ext of [
+        ".bat",
+        ".BaT",
+        ".bAT",
+        ".BAT",
+        ".bat.",
+        ".bat  ",
+        ".bat . ",
+      ]
+    ) {
       const fileName = tempDir + "/test" + ext;
       const output = await new Deno.Command(fileName, {
         args: ["&calc.exe"],
         stdout: "piped",
       }).output();
       const stdout = new TextDecoder().decode(output.stdout);
       // should have calc escaped here instead of executing it
-      assert(stdout.includes(`1 2 3 "&calc.exe\"`));
+      assert(stdout.includes(`1 2 3 "&calc.exe\"`), `Text: ${stdout}`);
     }
   },
 );
Repository: ggml-org/llama.cpp
Pull request: ggml-hexagon: replace sprintf with snprintf in `ops-utils.h`

## Description
Replace unsafe `sprintf` calls with `snprintf` to prevent potential buffer overflow vulnerabilities when handling larger values of `n`.

## Changes
- Replaced `sprintf` with `snprintf` in `ops-utils.h`
## Test 
TODO:


Changed files:
filename: ggml/src/ggml-hexagon/htp/ops-utils.h
patch: @@ -43,46 +43,46 @@ static inline int32_t htp_is_one_chunk(void * addr, uint32_t n, uint32_t chunk_s
 }
 
 static inline void htp_dump_int8_line(char * pref, const int8_t * x, int n) {
-    char str[1024], *p = str;
-    p += sprintf(p, "%s: ", pref);
-    for (int i = 0; i < 16; i++) {
-        p += sprintf(p, "%d, ", x[i]);
+    char str[1024], *p = str, *p_end = str + sizeof(str);
+    p += snprintf(p, p_end - p, "%s: ", pref);
+    for (int i = 0; i < n && p < p_end; i++) {
+        p += snprintf(p, p_end - p, "%d, ", x[i]);
     }
     FARF(HIGH, "%s\n", str);
 }
 
 static inline void htp_dump_uint8_line(char * pref, const uint8_t * x, uint32_t n) {
-    char str[1024], *p = str;
-    p += sprintf(p, "%s: ", pref);
-    for (int i = 0; i < n; i++) {
-        p += sprintf(p, "%d, ", x[i]);
+    char str[1024], *p = str, *p_end = str + sizeof(str);
+    p += snprintf(p, p_end - p, "%s: ", pref);
+    for (int i = 0; i < n && p < p_end; i++) {
+        p += snprintf(p, p_end - p, "%d, ", x[i]);
     }
     FARF(HIGH, "%s\n", str);
 }
 
 static inline void htp_dump_int32_line(char * pref, const int32_t * x, uint32_t n) {
-    char str[1024], *p = str;
-    p += sprintf(p, "%s: ", pref);
+    char str[1024], *p = str, *p_end = str + sizeof(str);
+    p += snprintf(p, p_end - p, "%s: ", pref);
     for (int i = 0; i < n; i++) {
-        p += sprintf(p, "%d, ", (int) x[i]);
+        p += snprintf(p, p_end - p, "%d, ", (int) x[i]);
     }
     FARF(HIGH, "%s\n", str);
 }
 
 static inline void htp_dump_fp16_line(char * pref, const __fp16 * x, uint32_t n) {
-    char str[1024], *p = str;
-    p += sprintf(p, "%s: ", pref);
+    char str[1024], *p = str, *p_end = str + sizeof(str);
+    p += snprintf(p, p_end - p, "%s: ", pref);
     for (int i = 0; i < n; i++) {
-        p += sprintf(p, "%.6f, ", (float) x[i]);
+        p += snprintf(p, p_end - p, "%.6f, ", (float) x[i]);
     }
     FARF(HIGH, "%s\n", str);
 }
 
 static inline void htp_dump_fp32_line(char * pref, const float * x, uint32_t n) {
-    char str[1024], *p = str;
-    p += sprintf(p, "%s: ", pref);
+    char str[1024], *p = str, *p_end = str + sizeof(str);
+    p += snprintf(p, p_end - p, "%s: ", pref);
     for (int i = 0; i < n; i++) {
-        p += sprintf(p, "%.6f, ", x[i]);
+        p += snprintf(p, p_end - p, "%.6f, ", x[i]);
     }
     FARF(HIGH, "%s\n", str);
 }