starsofchance/CVEfixes_v1.0.8 huggingface dataset:
CVE-2021-32434 (published 2022-03-10T17:42Z)

abcm2ps v8.14.11 was discovered to contain an out-of-bounds read in the function calculate_beam at draw.c.

Severity: MEDIUM
CVSS v2 base score: 4.3 (AV:N/AC:M/Au:N/C:N/I:N/A:P)
CVSS v3 base score: 5.5, MEDIUM (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H)

Weakness information:
cwe_id: CWE-125
cwe_name: Out-of-bounds Read
description: The product reads data past the end, or before the beginning, of the intended buffer.
extended_description: 
            
            
             
			 
         
         

Fix information:
repo_url: https://github.com/leesavide/abcm2ps
commit_details: repo_url: https://github.com/leesavide/abcm2ps
author: Jean-Francois Moine
author_date: 2021-04-27 11:52:27+02:00
msg: fix: array overflow when wrong duration in voice overlay

Issue #83,
repository: repo_url: https://github.com/leesavide/abcm2ps
repo_name: visit repo url
description: visit repo url
repo_language: visit repo url
owner: leesavide
file_changes: filename: parse.c
change_type: ModificationType.MODIFY
diff: @@ -2011,9 +2011,14 @@ static char txt_no_note[] = "No note in voice overlay";
 			error(1, s, "Erroneous end of voice overlap");
 			return;
 		}
-		if (p_voice->time != over_mxtime)
-			error(1, s, tx_wrong_dur);
 		curvoice = &voice_tb[over_voice];
+		if (p_voice->time != over_mxtime) {
+			error(1, s, tx_wrong_dur);
+			if (p_voice->time > over_mxtime)
+				curvoice->time = p_voice->time;
+			else
+				p_voice->time = curvoice->time;
+		}
 		over_mxtime = 0;
 		over_voice = -1;
 		over_time = -1;

programming_language: C
CVE-2022-28072 (published 2023-08-22T19:16Z)

A heap buffer overflow in r_read_le32 function in radare25.4.2 and 5.4.0.

CVSS v3 base score: 7.5, HIGH (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)

Weakness information:
cwe_id: CWE-787
cwe_name: Out-of-bounds Write
description: The product writes data past the end, or before the beginning, of the intended buffer.
extended_description: 
            
            
             
			 
         
         

Fix information:
repo_url: https://github.com/radareorg/radare2
commit_details: repo_url: https://github.com/radareorg/radare2
author: Sergi Àlvarez i Capilla
author_date: 2021-10-29 23:55:10+02:00
msg: Fix oobread crash in RAnal.hexagon (tests_64900) ##crash

Reported by giantbranch of NSFOCUS TIANJI Lab
repository: repo_url: https://github.com/radareorg/radare2
repo_name: radareorg/radare2
description: UNIX-like reverse engineering framework and command-line toolset
repo_language: C
owner: radareorg
file_changes: filename: anal_hexagon.c
change_type: ModificationType.MODIFY
diff: @@ -10,8 +10,11 @@
 #include "hexagon_anal.h"
 
 static int hexagon_v6_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
-	HexInsn hi = {0};;
+	HexInsn hi = {0};
 	ut32 data = 0;
+	if (len < 4) {
+		return 0;
+	}
 	data = r_read_le32 (buf);
 	int size = hexagon_disasm_instruction (data, &hi, (ut32) addr);
 	op->size = size;

programming_language: C
CVE-2023-0770 (published 2023-02-09T22:15Z)

Stack-based Buffer Overflow in GitHub repository gpac/gpac prior to 2.2.

CVSS v3 base score: 7.8, HIGH (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-787
cwe_name: Out-of-bounds Write
description: The product writes data past the end, or before the beginning, of the intended buffer.
extended_description: 
            
            
             
			 
         
         

Fix information:
repo_url: https://github.com/gpac/gpac
commit_details: repo_url: https://github.com/gpac/gpac
author: jeanlf
author_date: 2022-11-23 15:59:43+01:00
msg: fixed #2316
repository: repo_url: https://github.com/gpac/gpac
repo_name: gpac/gpac
description: GPAC Ultramedia OSS for Video Streaming & Next-Gen Multimedia Transcoding, Packaging & Delivery
repo_language: C
owner: gpac
file_changes: filename: vrml_proto.c
change_type: ModificationType.MODIFY
diff: @@ -1292,7 +1292,10 @@ Bool gf_sg_proto_field_is_sftime_offset(GF_Node *node, GF_FieldInfo *field)
 
 		gf_node_get_field(r->ToNode, r->ToField.fieldIndex, &inf);
 		/*IS to another proto*/
-		if (r->ToNode->sgprivate->tag == TAG_ProtoNode) return gf_sg_proto_field_is_sftime_offset(r->ToNode, &inf);
+		if (r->ToNode->sgprivate->tag == TAG_ProtoNode) {
+			if (r->ToNode==node) continue;
+			return gf_sg_proto_field_is_sftime_offset(r->ToNode, &inf);
+		}
 		/*IS to a startTime/stopTime field*/
 		if (!stricmp(inf.name, "startTime") || !stricmp(inf.name, "stopTime")) return 1;
 	}

programming_language: C
CVE-2022-26563 (published 2023-07-18T14:15Z)

An issue was discovered in Tildeslash Monit before 5.31.0, allows remote attackers to gain escilated privlidges due to improper PAM-authorization.

CVSS v3 base score: 8.8, HIGH (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-863
cwe_name: Incorrect Authorization
description: The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
extended_description: 
            Assuming a user with a given identity, authorization is the process of determining whether that user can access a given resource, based on the user's privileges and any permissions or other access-control specifications that apply to the resource.
            When access control checks are incorrectly applied, users are able to access data or perform actions that they should not be allowed to perform. This can lead to a wide range of problems, including information exposures, denial of service, and arbitrary code execution.
         
         

Fix information:
repo_url: https://bitbucket.org/tildeslash/monit
commit_details: repo_url: https://bitbucket.org/tildeslash/monit
author: tildeslash
author_date: 2022-03-03 20:30:09+01:00
msg: Fixed: PAM authentication: Users with a valid password for disabled account can login to Monit. Thanks to Youssef Rebahi-Gilbert.
repository: repo_url: https://bitbucket.org/tildeslash/monit
repo_name: visit repo url
description: visit repo url
repo_language: visit repo url
owner: tildeslash
file_changes: filename: CHANGES
change_type: ModificationType.MODIFY
diff: @@ -12,6 +12,9 @@ existed.
 Fixed: Issue #1029: The generic protocol test truncated the received data in the case that it
 contained zeros.
 
+Fixed: PAM authentication: Users with a valid password for disabled account can login to Monit.
+Thanks to Youssef Rebahi-Gilbert.
+
 
 Version 5.31.0
 

programming_language: Markdown
filename: util.c
change_type: ModificationType.MODIFY
diff: @@ -390,10 +390,10 @@ static bool PAMcheckPasswd(const char *login, const char *passwd) {
                 return false;
         }
 
-        rv = pam_authenticate(pamh, PAM_SILENT);
+        if ((rv = pam_authenticate(pamh, PAM_SILENT)) == PAM_SUCCESS)
+                rv = pam_acct_mgmt(pamh, PAM_SILENT);
 
-        if (pam_end(pamh, rv) != PAM_SUCCESS)
-                pamh = NULL;
+        pam_end(pamh, rv);
 
         return rv == PAM_SUCCESS ? true : false;
 }

programming_language: C
CVE-2023-25660 (published 2023-03-25T00:15Z)

TensorFlow is an open source platform for machine learning. Prior to versions 2.12.0 and 2.11.1, when the parameter `summarize` of `tf.raw_ops.Print` is zero, the new method `SummarizeArray<bool>` will reference to a nullptr, leading to a seg fault. A fix is included in TensorFlow version 2.12 and version 2.11.1.\n

CVSS v3 base score: 7.5, HIGH (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)

Weakness information:
cwe_id: CWE-476
cwe_name: NULL Pointer Dereference
description: The product dereferences a pointer that it expects to be valid but is NULL.
extended_description: 
            
            
            
         
         

Fix information:
repo_url: https://github.com/tensorflow/tensorflow
commit_details: repo_url: https://github.com/tensorflow/tensorflow
author: Mihai Maruseac
author_date: 2023-01-19 17:31:46-08:00
msg: Quick fix for a vuln in printing empty tensors.

PiperOrigin-RevId: 503308327
repository: repo_url: https://github.com/tensorflow/tensorflow
repo_name: tensorflow/tensorflow
description: An Open Source Machine Learning Framework for Everyone
repo_language: C++
owner: tensorflow
file_changes: filename: tensor.cc
change_type: ModificationType.MODIFY
diff: @@ -1297,6 +1297,9 @@ template <>
 string SummarizeArray<bool>(int64_t limit, int64_t num_elts,
                             const TensorShape& tensor_shape, const char* data,
                             const bool print_v2) {
+  if (data == nullptr) {
+    return strings::StrCat("");  // we already print type and shape
+  }
   // We first convert all chars to be 0/1 to not get InvalidEnumValue sanitizer
   // error
   auto mutable_data = std::unique_ptr<char[]>(new char[num_elts]);

programming_language: C++
CVE-2018-8786 (published 2018-11-29T18:29Z)

FreeRDP prior to version 2.0.0-rc4 contains an Integer Truncation that leads to a Heap-Based Buffer Overflow in function update_read_bitmap_update() and results in a memory corruption and probably even a remote code execution.

Severity: HIGH
CVSS v2 base score: 7.5 (AV:N/AC:L/Au:N/C:P/I:P/A:P)
CVSS v3 base score: 9.8, CRITICAL (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-787
cwe_name: Out-of-bounds Write
description: The product writes data past the end, or before the beginning, of the intended buffer.
extended_description: 
            
            
             
			 
         
         
cwe_id: CWE-681
cwe_name: Incorrect Conversion between Numeric Types
description: When converting from one data type to another, such as long to integer, data can be omitted or translated in a way that produces unexpected values. If the resulting values are used in a sensitive context, then dangerous behaviors may occur.
extended_description: 
            
            
            
         
         

Fix information:
repo_url: https://github.com/FreeRDP/FreeRDP
commit_details: repo_url: https://github.com/FreeRDP/FreeRDP
author: Armin Novak
author_date: 2018-10-22 16:25:13+02:00
msg: Fixed CVE-2018-8786

Thanks to Eyal Itkin from Check Point Software Technologies.
repository: repo_url: https://github.com/FreeRDP/FreeRDP
repo_name: FreeRDP/FreeRDP
description: FreeRDP is a free remote desktop protocol library and clients
repo_language: C
owner: FreeRDP
file_changes: filename: update.c
change_type: ModificationType.MODIFY
diff: @@ -208,11 +208,9 @@ BITMAP_UPDATE* update_read_bitmap_update(rdpUpdate* update, wStream* s)
 
 	if (bitmapUpdate->number > bitmapUpdate->count)
 	{
-		UINT16 count;
-		BITMAP_DATA* newdata;
-		count = bitmapUpdate->number * 2;
-		newdata = (BITMAP_DATA*) realloc(bitmapUpdate->rectangles,
-		                                 sizeof(BITMAP_DATA) * count);
+		UINT32 count = bitmapUpdate->number * 2;
+		BITMAP_DATA* newdata = (BITMAP_DATA*) realloc(bitmapUpdate->rectangles,
+		                       sizeof(BITMAP_DATA) * count);
 
 		if (!newdata)
 			goto fail;

programming_language: C
CVE-2015-1590 (published 2017-09-07T14:29Z)

The kamcmd administrative utility and default configuration in kamailio before 4.3.0 use /tmp/kamailio_ctl.

Severity: MEDIUM
CVSS v2 base score: 4.6 (AV:L/AC:L/Au:N/C:P/I:P/A:P)
CVSS v3 base score: 7.8, HIGH (CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-264
cwe_name: Permissions, Privileges, and Access Controls
description: Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.

Fix information:
repo_url: https://github.com/kamailio/kamailio
commit_details: repo_url: https://github.com/kamailio/kamailio
author: Victor Seva
author_date: 2015-04-16 11:58:23+02:00
msg: Merge pull request #89 from linuxmaniac/vseva/defaults

set defaults of fifo and ctl to /var/run/kamailio

Closes: #48
Closes: #89
repository: repo_url: https://github.com/kamailio/kamailio
repo_name: kamailio/kamailio
description: Kamailio - The Open Source SIP Server for large VoIP and real-time communication platforms -
repo_language: C
owner: kamailio
CVE-2020-24619 (published 2020-09-22T12:15Z)

In mainwindow.cpp in Shotcut before 20.09.13, the upgrade check misuses TLS because of setPeerVerifyMode(QSslSocket::VerifyNone). A man-in-the-middle attacker could offer a spoofed download resource.

Severity: MEDIUM
CVSS v2 base score: 4.3 (AV:N/AC:M/Au:N/C:N/I:P/A:N)
CVSS v3 base score: 5.9, MEDIUM (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N)

Weakness information:
cwe_id: CWE-295
cwe_name: Improper Certificate Validation
description: The product does not validate, or incorrectly validates, a certificate.
extended_description: When a certificate is invalid or malicious, it might allow an attacker to spoof a trusted entity by interfering in the communication path between the host and client. The product might connect to a malicious host while believing it is a trusted host, or the product might be deceived into accepting spoofed data that appears to originate from a trusted host.
         

Fix information:
repo_url: https://github.com/mltframework/shotcut
commit_details: repo_url: https://github.com/mltframework/shotcut
author: Dan Dennedy
author_date: 2020-08-22 14:03:33-07:00
msg: fix upgrade check is not using TLS correctly
repository: repo_url: https://github.com/mltframework/shotcut
repo_name: mltframework/shotcut
description: cross-platform (Qt), open-source (GPLv3) video editor
repo_language: C++
owner: mltframework
file_changes: filename: mainwindow.cpp
change_type: ModificationType.MODIFY
diff: @@ -3240,13 +3240,8 @@ void MainWindow::showUpgradePrompt()
 {
     if (Settings.checkUpgradeAutomatic()) {
         showStatusMessage("Checking for upgrade...");
-        QNetworkRequest request(QUrl("https://check.shotcut.org/version.json"));
-        QSslConfiguration sslConfig = request.sslConfiguration();
-        sslConfig.setPeerVerifyMode(QSslSocket::VerifyNone);
-        request.setSslConfiguration(sslConfig);
-        m_network.get(request);
+        m_network.get(QNetworkRequest(QUrl("https://check.shotcut.org/version.json")));
     } else {
-        m_network.setStrictTransportSecurityEnabled(false);
         QAction* action = new QAction(tr("Click here to check for a new version of Shotcut."), 0);
         connect(action, SIGNAL(triggered(bool)), SLOT(on_actionUpgrade_triggered()));
         showStatusMessage(action, 15 /* seconds */);
@@ -3702,7 +3697,7 @@ void MainWindow::on_actionUpgrade_triggered()
             Settings.setAskUpgradeAutomatic(false);
     }
     showStatusMessage("Checking for upgrade...");
-    m_network.get(QNetworkRequest(QUrl("http://check.shotcut.org/version.json")));
+    m_network.get(QNetworkRequest(QUrl("https://check.shotcut.org/version.json")));
 }
 
 void MainWindow::on_actionOpenXML_triggered()

programming_language: C++
CVE-2022-31117 (published 2022-07-05T18:15Z)

UltraJSON is a fast JSON encoder and decoder written in pure C with bindings for Python 3.7+. In versions prior to 5.4.0 an error occurring while reallocating a buffer for string decoding can cause the buffer to get freed twice. Due to how UltraJSON uses the internal decoder, this double free is impossible to trigger from Python. This issue has been resolved in version 5.4.0 and all users should upgrade to UltraJSON 5.4.0. There are no known workarounds for this issue.

Severity: MEDIUM
CVSS v2 base score: 4.3 (AV:N/AC:M/Au:N/C:N/I:N/A:P)
CVSS v3 base score: 5.9, MEDIUM (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H)

Weakness information:
cwe_id: CWE-415
cwe_name: Double Free
description: The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations.
extended_description: When a program calls free() twice with the same argument, the program's memory management data structures become corrupted. This corruption can cause the program to crash or, in some circumstances, cause two later calls to malloc() to return the same pointer. If malloc() returns the same value twice and the program later gives the attacker control over the data that is written into this doubly-allocated memory, the program becomes vulnerable to a buffer overflow attack.
         

Fix information:
repo_url: https://github.com/ultrajson/ultrajson
commit_details: repo_url: https://github.com/ultrajson/ultrajson
author: Hugo van Kemenade
author_date: 2022-07-02 08:11:59+03:00
msg: Merge pull request from GHSA-fm67-cv37-96ff

Fix double free on string decoding if realloc fails
repository: repo_url: https://github.com/ultrajson/ultrajson
repo_name: ultrajson/ultrajson
description: Ultra fast JSON decoder and encoder written in C with Python bindings
repo_language: C
owner: ultrajson
CVE-2017-15931 (published 2017-10-27T18:29Z)

In radare2 2.0.1, an integer exception (negative number leading to an invalid memory access) exists in store_versioninfo_gnu_verneed() in libr/bin/format/elf/elf.c via crafted ELF files on 32bit systems.

Severity: MEDIUM
CVSS v2 base score: 6.8 (AV:N/AC:M/Au:N/C:P/I:P/A:P)
CVSS v3 base score: 7.8, HIGH (CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-125
cwe_name: Out-of-bounds Read
description: The product reads data past the end, or before the beginning, of the intended buffer.
extended_description: 
            
            
             
			 
         
         

Fix information:
repo_url: https://github.com/radare/radare2
commit_details: repo_url: https://github.com/radare/radare2
author: pancake
author_date: 2017-10-25 18:00:11+02:00
msg: Fix #8731 - Crash in ELF parser with negative 32bit number
repository: repo_url: https://github.com/radare/radare2
repo_name: radareorg/radare2
description: UNIX-like reverse engineering framework and command-line toolset
repo_language: C
owner: radare
file_changes: filename: elf.c
change_type: ModificationType.MODIFY
diff: @@ -900,7 +900,11 @@ static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
 			free (s);
 		}
 		sdb_num_set (sdb_version, "cnt", entry->vn_cnt, 0);
-		vstart += entry->vn_aux;
+		st32 vnaux = entry->vn_aux;
+		if (vnaux < 1) {
+			goto beach;
+		}
+		vstart += vnaux;
 		for (j = 0, isum = i + entry->vn_aux; j < entry->vn_cnt && vstart + sizeof (Elf_(Vernaux)) <= end; ++j) {
 			int k;
 			Elf_(Vernaux) * aux = NULL;

programming_language: C
CVE-2022-40299 (published 2022-09-09T01:15Z)

In Singular before 4.3.1, a predictable /tmp pathname is used (e.g., by sdb.cc), which allows local users to gain the privileges of other users via a procedure in a file under /tmp. NOTE: this CVE Record is about sdb.cc and similar files in the Singular interface that have predictable /tmp pathnames; this CVE Record is not about the lack of a safe temporary-file creation capability in the Singular language.

CVSS v3 base score: 7.8, HIGH (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-330
cwe_name: Use of Insufficiently Random Values
description: The product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
extended_description: When product generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
         

Fix information:
repo_url: https://github.com/Singular/Singular
commit_details: repo_url: https://github.com/Singular/Singular
author: Hans Schoenemann
author_date: 2022-05-24 11:02:32+02:00
msg: use mkstemp for sdb
repository: repo_url: https://github.com/Singular/Singular
repo_name: Singular/Singular
description: sources for the Singular computer algebra system
repo_language: C++
owner: Singular
file_changes: filename: sdb.cc
change_type: ModificationType.MODIFY
diff: @@ -108,10 +108,9 @@ BOOLEAN sdb_set_breakpoint(const char *pp, int given_lineno)
 
 void sdb_edit(procinfo *pi)
 {
-  char * filename = omStrDup("/tmp/sd000000");
-  sprintf(filename+7,"%d",getpid());
-  FILE *fp=fopen(filename,"w");
-  if (fp==NULL)
+  char * filename = omStrDup("/tmp/sdXXXXXX");
+  int f=mkstemp(filename);
+  if (f==-1)
   {
     Print("cannot open %s\n",filename);
     omFree(filename);
@@ -120,8 +119,8 @@ void sdb_edit(procinfo *pi)
   if (pi->language!= LANG_SINGULAR)
   {
     Print("cannot edit type %d\n",pi->language);
-    fclose(fp);
-    fp=NULL;
+    close(f);
+    f=NULL;
   }
   else
   {
@@ -138,15 +137,15 @@ void sdb_edit(procinfo *pi)
       if (pi->data.s.body==NULL)
       {
         PrintS("cannot get the procedure body\n");
-        fclose(fp);
+        close(f);
         si_unlink(filename);
         omFree(filename);
         return;
       }
     }
 
-    fwrite(pi->data.s.body,1,strlen(pi->data.s.body),fp);
-    fclose(fp);
+    write(f,pi->data.s.body,strlen(pi->data.s.body));
+    close(f);
 
     int pid=fork();
     if (pid!=0)
@@ -173,7 +172,7 @@ void sdb_edit(procinfo *pi)
       PrintS("cannot fork\n");
     }
 
-    fp=fopen(filename,"r");
+    FILE* fp=fopen(filename,"r");
     if (fp==NULL)
     {
       Print("cannot read from %s\n",filename);

programming_language: C
CVE-2020-15269 (published 2020-10-20T21:15Z)

In Spree before versions 3.7.11, 4.0.4, or 4.1.11, expired user tokens could be used to access Storefront API v2 endpoints. The issue is patched in versions 3.7.11, 4.0.4 and 4.1.11. A workaround without upgrading is described in the linked advisory.

Severity: MEDIUM
CVSS v2 base score: 6.4 (AV:N/AC:L/Au:N/C:P/I:P/A:N)
CVSS v3 base score: 9.1, CRITICAL (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N)

Weakness information:
cwe_id: CWE-613
cwe_name: Insufficient Session Expiration
description: According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
extended_description: 
            
            
            
         
         

Fix information:
repo_url: https://github.com/spree/spree
commit_details: repo_url: https://github.com/spree/spree
author: Jorge Morante
author_date: 2020-10-12 16:49:04+02:00
msg: ensure doorkeeper_token is valid when authenticating requests in v2
repository: repo_url: https://github.com/spree/spree
repo_name: spree/spree
description: An open source eCommerce platform giving you full control and customizability. Modular and API-first. Build any eCommerce solution that your business requires.
repo_language: Ruby
owner: spree
file_changes: filename: base_controller.rb
change_type: ModificationType.MODIFY
diff: @@ -53,7 +53,12 @@ module Spree
         end
 
         def spree_current_user
-          @spree_current_user ||= Spree.user_class.find_by(id: doorkeeper_token.resource_owner_id) if doorkeeper_token
+          return nil unless doorkeeper_token
+          return @spree_current_user if @spree_current_user
+
+          doorkeeper_authorize!
+
+          @spree_current_user ||= Spree.user_class.find_by(id: doorkeeper_token.resource_owner_id)
         end
 
         def spree_authorize!(action, subject, *args)

programming_language: Ruby
filename: base.rb
change_type: ModificationType.MODIFY
diff: @@ -4,7 +4,7 @@ shared_context 'API v2 tokens' do
   let(:headers_order_token) { { 'X-Spree-Order-Token' => order.token } }
 end
 
-[200, 201, 400, 404, 403, 422].each do |status_code|
+[200, 201, 400, 401, 404, 403, 422].each do |status_code|
   shared_examples "returns #{status_code} HTTP status" do
     it "returns #{status_code}" do
       expect(response.status).to eq(status_code)

programming_language: Ruby
filename: errors_spec.rb
change_type: ModificationType.MODIFY
diff: @@ -29,4 +29,19 @@ describe 'API v2 Errors spec', type: :request do
       expect(json_response['error']).to eq('You are not authorized to access this page.')
     end
   end
+
+  context 'expired token failure' do
+    let(:user) { create(:user) }
+    let(:headers) { headers_bearer }
+
+    include_context 'API v2 tokens'
+
+    before do
+      token.expires_in = -1
+      token.save
+      get '/api/v2/storefront/account', headers: headers
+    end
+
+    it_behaves_like 'returns 401 HTTP status'
+  end
 end

programming_language: Ruby