Thread Like Summary
Gizmo, isaac
Total Likes: 4
Original Post (Thread Starter)
by Morgan
Morgan
Noticed this error log, could it be a bug?
Thanks
Morgan


Sat, Mar 21 2020 14:57:18 +0000
Script: xxxxx/xxxxx/xxxxx/scripts/postlist.inc.php - Line: 496
SELECT
t1.TOPIC_ID, t1.POST_ID, t2.USER_DISPLAY_NAME, t1.TOPIC_CREATED_TIME, t1.TOPIC_LAST_REPLY_TIME, t1.TOPIC_SUBJECT,
t1.TOPIC_STATUS, t1.TOPIC_IS_APPROVED, t1.TOPIC_ICON, t1.TOPIC_VIEWS, t1.TOPIC_REPLIES, t1.TOPIC_TOTAL_RATES,
t1.TOPIC_RATING, t3.USER_NAME_COLOR, t2.USER_MEMBERSHIP_LEVEL, t1.USER_ID, t1.TOPIC_IS_STICKY, t1.TOPIC_LAST_POSTER_ID,
t1.TOPIC_LAST_POSTER_NAME, t1.TOPIC_LAST_POST_ID, t1.TOPIC_IS_EVENT, t1.TOPIC_HAS_FILE, t1.TOPIC_HAS_POLL, t1.TOPIC_POSTER_NAME, t1.TOPIC_THUMBNAIL, t4.POST_BODY, t3.USER_GROUP_IMAGES
FROM
ubbt_TOPICS AS t1
LEFT JOIN ubbt_USERS AS t2 ON t1.USER_ID = t2.USER_ID
LEFT JOIN ubbt_USER_PROFILE AS t3 ON t1.USER_ID = t3.USER_ID
LEFT JOIN ubbt_POSTS AS t4 ON t1.POST_ID = t4.POST_ID
WHERE
t1.FORUM_ID = 1
AND t1.TOPIC_IS_STICKY = '0'

AND t1.TOPIC_IS_APPROVED = '1'
ORDER BY t1.TOPIC_LAST_REPLY_TIME desc
LIMIT 3.0302802803E+14, 26
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3.0302802803E+14, 26' at line 17
Liked Replies
by Gizmo
Gizmo
These don't seem like legitimate requests; I say that as the "limit" is "1.81816816818E+14" which is throwing the error... It'd appear that invalid data is being passed as the page number in user requests...
Valid: https://www.ubbcentral.com/forums/ubbthreads.php/forums/3/1/bug-reports
Invalid: https://www.ubbcentral.com/forums/ubbthreads.php/forums/3/1.54/bug-reports (see the .)
Invalid: https://www.ubbcentral.com/forums/ubbthreads.php/forums/3/1238762837698623849762345/bug-reports (see the absurdly long page number)

Do you have legitimate users reporting problems with viewing forums, or are you simply just pulling information from SQL logs?

Its entirely possible that this is some bot that sees that the page id is fetched via a URL and is pinging every conceivable page for content, and at some point it gets such a high number that it begins generating errors...
1 member likes this
by Gizmo
Gizmo
The value for the current page of a thread is invalid; that is why MySQL is returning an error (you can generate the error by throwing a huge number in the "page" value of the URL; anything higher than 99999999999999999 will throw the error, whereas 99999999999999999 and below will be smooth sailing).

From your logs, the page values are:
Morgan: LIMIT 27755.25, 26
Driv: limit 3.0302802803028E+14, 25

I figure that I should post this again, since I posted it in April and had absolutely zero feedback.
Quote
Do you have legitimate users reporting problems with viewing forums, or are you simply just pulling information from SQL logs?

How many entries for these invalid queries are in your logs? How large are your log files? It would seem that it could be a bot of some sort just trying to increase pages to infinity during a crawl to get invalid values.

I have merged this with the previous bug report thread; but the issue remains the same, invalid pages are being passed from the user browser to the system.
1 member likes this
by isaac
isaac
The error presented seems to be triggered when a URL has been manipulated to add more pages than what is intended or is available.

The errors do not break anything or share private information with any of your forum visitors. When triggered, a basic error message is displayed to the user (full error if you have debugging turned on). The full SQL error is appended to the daily SQL error log file when you have Database Error Logging enabled.


You can receive the following fixes when UBB.threads 7.7.5 is released, or you can apply them yourself now. The fixes are simple and are added below:

FIND IN /scripts/activetopics.inc.php
AROUND LINE 122
Code
	// What is our limit clause?
	if ($page == 1) {
		$limit = "limit $PostsPer";
	} else {
		$limit = "limit " . (($page - 1) * $PostsPer) . ", $PostsPer";
	}
REPLACE WITH:
Code
	// What is our limit clause?
	if ($page == 1) {
		$limit = "LIMIT $PostsPer";
	} else {
		$Startat = ($page - 1) * $PostsPer;
		if (!is_int($Startat)) $Startat = 0;
		$limit = "LIMIT $Startat, $PostsPer";
	}


FIND IN /scripts/postlist.inc.php
AROUND LINE 461
Code
	// the previous and nexts posts will be
	if ($page == 1) {
		$Totalgrab = $PostsPer;
		$Posts = $PostsPer + 1;
	} else {
		$Startat = ($page - 1) * $PostsPer;
		$Posts = $PostsPer + 1;
		if (!is_numeric($Startat)) $Startat = 0;
		$Totalgrab = "$Startat, $Posts";
	}
REPLACE WITH:
Code
	// the previous and nexts posts will be
	if ($page == 1) {
		$Totalgrab = $PostsPer;
		$Posts = $PostsPer + 1;
	} else {
		$Startat = ($page - 1) * $PostsPer;
		$Posts = $PostsPer + 1;
		if (!is_int($Startat)) $Startat = 0;
		$Totalgrab = "$Startat, $Posts";
	}


FIND IN /scripts/showmembers.inc.php
AROUND LINE 141
Code
	// Here we grab the users for this page
	if ($page == 1) {
		$Totalgrab = $per_page;
	} else {
		$Startat = (($page - 1) * $per_page);
		if ($Startat < 0) $Startat = 0;
		$Totalgrab = "$Startat, $per_page";
	}
REPLACE WITH:
Code
	// Here we grab the users for this page
	if ($page == 1) {
		$Totalgrab = $per_page;
	} else {
		$Startat = ($page - 1) * $per_page;
		if (!is_int($Startat)) $Startat = 0;
		$Totalgrab = "$Startat, $per_page";
	}
1 member likes this
by Morgan
Morgan
Originally Posted by isaac
You can receive the following fixes when UBB.threads 7.7.5 is released, or you can apply them yourself now. The fixes are simple and are added below:

Isaac, I got seven error messages like this today so I applied your fixes in those three files.
Hopefully it will be ok now. I'll give feedback after a while.

Thanks
1 member likes this
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
spam issues
by ECNet - 03/19/2024 11:45 PM
Who's Online Now
1 members (Ruben), 802 guests, and 202 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)